Sign in to follow this  
Followers 0
changtraingheo

how to make Combo Box same select tag in html

2 posts in this topic

in the autoit, to make combox use this code:

$input_second_mau = GUICtrlCreateCombo("item1",105,22,50)
GUICtrlSetData($input_second_mau, "item2|item3", "item3")

I try get value when select an item with code:

MsgBox(0,"title","Value = " & GUICtrlRead($input_second_mau))

If i select item 3, i got value is "item3". It's get text not get value of combo box, if i change "item3" to "Help and Support" .. i got value is "Help and support" too, it's so hard compare, example:

if GUICtrlRead($input_second_mau) == "Help and Support" .... ; it's not good

In the html:

<select onChange="alert(this.value)">
<option value="1">Item 1</option>
<option value="2">Help and support</option>
</select>

when i select Help and Support, i got value is 2. I'm a newbie, i need help this problem. Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

you can do this with a little Switch ... EndSwitch:

Switch GUICtrlRead($input_second_mau)
        Case "Item1"
                $value = 1
        Case "Item2"
                $value = 2
        Case "Item3"
                $value = 3
EndSwitch

But I'm afraid, that autoit does not differ between value and description here.

Edited by hannes08

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

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