=sinister= Posted September 26, 2009 Share Posted September 26, 2009 So im trying to get the text of an item in a listview control, and I use this code: MsgBox(0, "Test", _GUICtrlListView_GetSelectedIndices($VideoList)) ;//Returns 0 if the first item in the list view control is selected MsgBox(0, "Test", _GUICtrlListView_GetItemText($VideoList, 0)) ;// Returns the text of the first item in the list view control MsgBox(0, "Test", _GUICtrlListView_GetItemText($VideoList, _GUICtrlListView_GetSelectedIndices($VideoList))) ;// Returns nothing???? The last line returns nothing and I have no idea why? Link to comment Share on other sites More sharing options...
smashly Posted September 27, 2009 Share Posted September 27, 2009 (edited) Hi, few ways to solve it.. If your Listview is created with autoit internal function GuiCtrlCreateListView() then you can do either or both of the following. 1) Get and use the handle of the GuiCtrlCreateListView() instead of passing a Control ID eg: $hVideoList = GUICtrlGetHandle($VideoList) 2) When passing _GUICtrlListView_GetSelectedIndices($VideoList) make it an Int value eg: Int(_GUICtrlListView_GetSelectedIndices($VideoList)) so your code could be: $hVideoList = GUICtrlGetHandle($VideoList) MsgBox(0, "Test", _GUICtrlListView_GetItemText($hVideoList, _GUICtrlListView_GetSelectedIndices($hVideoList)))OrMsgBox(0, "Test", _GUICtrlListView_GetItemText($VideoList, Int(_GUICtrlListView_GetSelectedIndices($VideoList))))or$hVideoList = GUICtrlGetHandle($VideoList) MsgBox(0, "Test", _GUICtrlListView_GetItemText($hVideoList, Int(_GUICtrlListView_GetSelectedIndices($hVideoList)))) Also if your using a multi select listview, then you could use _GUICtrlListView_GetNextItem() instead of _GUICtrlListView_GetSelectedIndices(). This way your sure to get an Int value. With _GUICtrlListView_GetSelectedIndices() it can return a string of delimited Int values eg: eg: "0|1|2|3".. which is not a true Int. Cheers Edited September 27, 2009 by smashly Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now