Cheblon Posted November 12, 2008 Share Posted November 12, 2008 I need to get the index number of a selected item in a list box. The list box is created by me and so for some reason the command ControlListView doesnt seem to work. GUICtrlRead works but only returns the value in the list and not the index number of that item. Any help is great, thanks. Link to comment Share on other sites More sharing options...
Achilles Posted November 12, 2008 Share Posted November 12, 2008 _GUICtrlListView_GetSelectedIndices() Look at it in the helpfile. Welcome to the AutoIt forums. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Cheblon Posted November 12, 2008 Author Share Posted November 12, 2008 thanks, i will try this out Link to comment Share on other sites More sharing options...
Cheblon Posted November 13, 2008 Author Share Posted November 13, 2008 It worked but now it no longer responds to the list item changing. I am using the method below to check for the item change: while 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $lstSUname MsgBox(0,"",_GUICtrlListView_GetSelectedIndices($lstSUname)) EndSwitch WEnd I am new to user functions so if there is another way of checking the item change please say Thanks again Link to comment Share on other sites More sharing options...
martin Posted November 13, 2008 Share Posted November 13, 2008 (edited) It worked but now it no longer responds to the list item changing. I am using the method below to check for the item change: while 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $lstSUname MsgBox(0,"",_GUICtrlListView_GetSelectedIndices($lstSUname)) EndSwitch WEnd I am new to user functions so if there is another way of checking the item change please say Thanks againIf it's a list box you are using then look at the example in the help for _GUICtrlListBox_GetSelItems If it's a Listview then you have a parameter missing in _GUICtrlListView_GetSelectedIndices, see the help. Edited November 13, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Cheblon Posted November 13, 2008 Author Share Posted November 13, 2008 I am using a ListView. Is there a way to check when the selection has been changed? Link to comment Share on other sites More sharing options...
Achilles Posted November 13, 2008 Share Posted November 13, 2008 (edited) I am using a ListView. Is there a way to check when the selection has been changed?Look at the example for _GUICtrlListView_Create(). Run this in Scite, if you don't have Scite, get it. Down at the bottom you will see message pop up everytime you click an item on the listivew. You can change that code to do whatever you want to.Edit: Scite Edited November 13, 2008 by Ichigo My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Cheblon Posted November 14, 2008 Author Share Posted November 14, 2008 thank you, all works now 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