Leoj Posted May 14, 2007 Posted May 14, 2007 Anyone got any ideas of how to set which list item is selected? The only thing I see is [GUICtrlSetState] and [GUICtrlSetData] that could do anything like what I am suggesting. But both do not do what I need. They either overwrite the data or do not apply to a list view. GUICtrlCreateList("Hello", 48, 80, 305, 150, -1, $WS_EX_CLIENTEDGE) GUICtrlSetData(-1, "Goodbye") ;;;and then a function that tells the GUI that 'Goodbye' should be selected no matter what else is in the list. Func selectGoodbye() ;;;I have no idea how to make it select 'Goodbye'... but if I did it would go here. EndFunc Thanks if you spend any time reading or thinking about this =)
smashly Posted May 14, 2007 Posted May 14, 2007 (edited) Hi, Have you looked in the AutoIt Help File under 'User Defined Functions -> GuiList Management' ? There's a bunch of functions you can use to accomplish what your after. Also you can use GuiCtrlSetData() like this to populate the list with values: #include <GuiConstants.au3> GUICreate('List', 400, 300, -1, -1, -1) $List = GUICtrlCreateList('', 10, 10, 380, 280) GUICtrlSetData(-1, "Hello|Goodbye|Google|Whatever", 'Whatever') GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd Good Luck Cheers Edited May 14, 2007 by smashly
Leoj Posted May 14, 2007 Author Posted May 14, 2007 I think I will be using: _GUICtrlListSelectString ... for anyone who may be looking for the same UDF. Thanks much smashly, your becomming my best friend on these forums =). Hope it works, I have to wait until I get home to try it.
Davo Posted May 16, 2007 Posted May 16, 2007 CODE _GUICtrlListSelectIndex($listBoxHandle,_GUICtrlListFindString($listBoxHandle,$stringToSearchFor,$exactMatch=1or0)) Hope it helps. Dave ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------"I don't need to know everything, I just need to know where to find it when I need it"....EinsteinAnd in our case... That's the AutoIT helpfile ;) Please read before posting!!!
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