AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ListView - Currently Selected Row?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Tue Nov 17, 2009 10:18 am    Post subject: ListView - Currently Selected Row? Reply with quote

How would I go about getting the currently selected row of a list view without:

Code:
[...]
Gui, Add, ListView, vMyListView gClicked, Column 1|Column 2
[...]
Clicked:
Selected_Row := A_EventInfo
Return


Is there a LV_GetSelected() or something that I'm not seeing?

Thanks in advance!
Back to top
aaffe



Joined: 17 May 2007
Posts: 941
Location: Germany - Deutschland

PostPosted: Tue Nov 17, 2009 10:46 am    Post subject: Reply with quote

From the help file:
Code:
MyListView:
if A_GuiEvent = DoubleClick
{
    LV_GetText(RowText, A_EventInfo)  ; Get the text from the row's first field.
    ToolTip You double-clicked row number %A_EventInfo%. Text: "%RowText%"
}
return
Back to top
View user's profile Send private message
aaffe



Joined: 17 May 2007
Posts: 941
Location: Germany - Deutschland

PostPosted: Tue Nov 17, 2009 10:48 am    Post subject: Reply with quote

and:
Quote:
G-Label Notifications (Primary)
A g-label such as gMySubroutine may be listed in the control's options. This would cause the MySubroutine label to be launched automatically whenever the user performs an action in the control. This subroutine may consult the built-in variables A_Gui and A_GuiControl to find out which window and ListView generated the event. More importantly, it may consult A_GuiEvent, which contains one of the following strings or letters (for compatibility with future versions, a script should not assume these are the only possible values):

DoubleClick: The user has double-clicked a row. The variable A_EventInfo contains the row number.

R: The user has double-right-clicked within the control. The variable A_EventInfo contains the focused row number.

ColClick: The user has clicked a column header. The variable A_EventInfo contains the column number, which is the original number assigned when the column was created; that is, it does not reflect any dragging and dropping of columns done by the user. One possible response to a column click is to sort by a hidden column (zero width) that contains data in a sort-friendly format (such as a YYYYMMDD integer date). Such a hidden column can mirror some other column that displays the same data in a more friendly format (such as MM/DD/YY). For example, a script could hide column 3 via LV_ModifyCol(3, 0), then disable automatic sorting in the visible column 2 via LV_ModifyCol(2, "NoSort"). Then in response to the ColClick notification for column 2, the script would sort the ListView by the hidden column via LV_ModifyCol(3, "Sort").

D: The user has attempted to start dragging a row or icon (there is currently no built-in support for dragging rows or icons). The variable A_EventInfo contains the focused row number. In v1.0.44+, this notification occurs even without AltSubmit.

d (lowercase D): Same as above except a right-click-drag rather than a left-drag.

e (lowercase E): The user has finished editing the first field of a row (the user may edit it only when the ListView has -ReadOnly in its options). The variable A_EventInfo contains the row number.

Back to top
View user's profile Send private message
Peter



Joined: 30 Dec 2005
Posts: 448

PostPosted: Tue Nov 17, 2009 11:04 am    Post subject: Reply with quote

Guest wrote:
Is there a LV_GetSelected() or something that I'm not seeing?
I guess you didn't see long enough, because also in Help File after a 15 sec. search for "select" w/ Ctrl-F in the ListView page:
Quote:
LV_GetNext([StartingRowNumber, "Checked | Focused"]): Returns the row number of the next selected, checked, or focused row.
(PS: It took more time to write this post then finding your answer. There is even an example in the Help file Rolling Eyes )
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group