Jump to content
Sign in to follow this  
cyberparam

GUI Combo box

Recommended Posts

cyberparam

Hi, I have created a simple combo box inside a GUI window

Code:

$combo = GUICtrlCreateCombo ("item1", 40, 120, 250, 20)

$read = GUICtrlSetData(-1,"item2|item3")

$comboData = GUICtrlRecvMsg($combo)

In the GUI when i change selection to item2 or item3, and try to read data from the Combo box, I get 'item1' but not 'item2' or 'item3' inside $comboData. Why is this so?

Share this post


Link to post
Share on other sites
Andreik

Hi, I have created a simple combo box inside a GUI window

Code:

$combo = GUICtrlCreateCombo ("item1", 40, 120, 250, 20)

$read = GUICtrlSetData(-1,"item2|item3")

$comboData = GUICtrlRecvMsg($combo)

In the GUI when i change selection to item2 or item3, and try to read data from the Combo box, I get 'item1' but not 'item2' or 'item3' inside $comboData. Why is this so?

GuiCtrlRead($combo)


When the words fail... music speaks

Share this post


Link to post
Share on other sites
cyberparam

GuiCtrlRead($combo)

Even GUICtrlRead($combo) gives 'item1' as result? I don.t get 'item2' or 'item3' when i select them?

Please help.

Share this post


Link to post
Share on other sites
ResNullius

Even GUICtrlRead($combo) gives 'item1' as result? I don.t get 'item2' or 'item3' when i select them?

Please help.

Try this:

#include<GuiConstants.au3>
GUICreate("")
$combo = GUICtrlCreateCombo ("item1", 40, 120, 250, 20)
$read = GUICtrlSetData(-1,"item2|item3")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $combo
            $comboData = GUICtrlRead($combo)
            MsgBox(0,"",$comboData)
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
cyberparam

thank you RN.

Share this post


Link to post
Share on other sites
ResNullius

thank you RN.

You're welcome.

Edit: can't even spell "you're" right this morning :)

Edited by ResNullius

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  

×