Jump to content

Easy GUICtrlRead Issue


Recommended Posts

I've been working on this for hours and I know I'm missing something simple. All I want it to do is to return the text selected in the combo. The script always returns the text defined in GuiCtrlCreateCombo and ignores any data set from the GUICtrlSetData. I know this is easy, your help is appreciated.

#include <GUIConstantsEx.au3>

GUICreate("Test", 500, 500)
GUICtrlCreateLabel("test", 135, 10)

    $productlist = "product1|product2|product3"
    $product = GUICtrlCreateCombo("Select a Product", 210, 85, 150, 100)
    GUICtrlSetData(-1, $productlist)
    $dropit = GUICtrlCreateButton ( "Drop It!", 210, 420 , 90 , 20)
    $productget = GUICtrlRead($product)

    GUISetState(@SW_SHOW)
    
    While 1
  $msg = GUIGetMsg()


  Select
  Case $msg = $dropit
    ClipPut($productget)
    
          Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  EndSelect
WEnd
Link to comment
Share on other sites

Need to read the control AFTER the selections

#include <GUIConstantsEx.au3>

GUICreate("Test", 500, 500)
GUICtrlCreateLabel("test", 135, 10)

    $productlist = "product1|product2|product3"
    $product = GUICtrlCreateCombo("Select a Product", 210, 85, 150, 100)
    GUICtrlSetData(-1, $productlist)
    $dropit = GUICtrlCreateButton ( "Drop It!", 210, 420 , 90 , 20)

    GUISetState(@SW_SHOW)
    
    While 1
  $msg = GUIGetMsg()


  Select
  Case $msg = $dropit
    ClipPut(GUICtrlRead($product))
    
          Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  EndSelect
WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

Need to read the control AFTER the selections

#include <GUIConstantsEx.au3>

GUICreate("Test", 500, 500)
GUICtrlCreateLabel("test", 135, 10)

    $productlist = "product1|product2|product3"
    $product = GUICtrlCreateCombo("Select a Product", 210, 85, 150, 100)
    GUICtrlSetData(-1, $productlist)
    $dropit = GUICtrlCreateButton ( "Drop It!", 210, 420 , 90 , 20)

    GUISetState(@SW_SHOW)
    
    While 1
  $msg = GUIGetMsg()


  Select
  Case $msg = $dropit
    ClipPut(GUICtrlRead($product))
    
          Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  EndSelect
WEnd

8)

Oi. Told ya it was easy. Thanks so much!

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