Sign in to follow this  
Followers 0
sensalim

GUICtrlSetOnEvent ... on a combo?

5 posts in this topic

I have a combo (dropdown) box... with 2 or 3 items in it.

How do I do it so that if the user changes the dropdown from item1 to item2 or whatever, it would call a function

You know, like in html-java script:

<select name="test" onchange="dothat()">

...

</select>

What about in Autoit?

Thanks.

Share this post


Link to post
Share on other sites



I suppose you'd have to do something like this:

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

GUICreate("Form1", 306, 118, 218, 121)
$Combo1 = GUICtrlCreateCombo("", 30, 34, 245, 100)
GUICtrlSetData(-1,"Fred|Jhonny|Jack","Jebus")
GUICtrlSetOnEvent(-1,"_ComboRead")
GUISetState(@SW_SHOW)
GUISetOnEvent($GUI_EVENT_CLOSE,"_quit")

While 1
    Sleep(100)
WEnd

Func _Quit()
    Exit
EndFunc

Func _ComboRead()
    $sName=GUICtrlRead($Combo1)
    MsgBox(0,"",$sName)
EndFunc

Share this post


Link to post
Share on other sites

That worked. Now is there a way to have a button that scroll this combo box down and another to scroll it up?

Thanks.

Share this post


Link to post
Share on other sites

OK I think I will use UDF GUICombo.au3

but when I use that, I get this error

"Line 61 (File Misc.au3"):

Local $p = DllStructCreate($struct)

Local $p = ^ ERROR

Error: Unknown function name"

What do I do?

Thanks.

Share this post


Link to post
Share on other sites

Fixed. I was not using the latest autoit version.

Thanks!

Share this post


Link to post
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
Sign in to follow this  
Followers 0