Jump to content

Select top item of listbox without using strings of existing listdata value


NDog
 Share

Recommended Posts

1) How I can make a listbox 'click' or select the top, or first value of a listbox which has existing data. I dont need to search for a string just simply select top most item in listbox

2) If I have 2 listboxes, how do you click an item on 1 list box to then go and perform a function straight away

Thanks

Link to comment
Share on other sites

1) _GUICtrlListBox_ClickItem(), see help file.

2) When the ListBox is clicked, the control ID is returned for GuiGetMsg(), then you have to use GuiCtrlRead() or ControlCommand() to get the value.

:unsure:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

1) _GUICtrlListBox_ClickItem(), see help file.

This works however it moves the mouse cursor (undesirable). I shouldn't have said "click" item .. :unsure:

possible alternatives

1) save mouse cordinates and remember them after click (undesirable)

2) when adding data to listbox detect first item being added and add as default. But when I add more data will this still be selected? (requires loops and counting when adding data, if it works it works)

3) inbuilt autoit function to select the index 0 item (desirable)

2) When the ListBox is clicked, the control ID is returned for GuiGetMsg(), then you have to use GuiCtrlRead() or ControlCommand() to get the value.

Thanks. This is useful info and Im using this code for the routine.

GUICtrlSetOnEvent($hDiskList, "ListClicked")
Func ListClicked()
    MsgBox(0,"hi",GuiCtrlRead($hDiskList))
EndFunc
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...