Jump to content

GUI Combo box


Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
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...