Jump to content
Sign in to follow this  
JetsterDajet

Easy GUICtrlRead Issue

Recommended Posts

JetsterDajet

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

Share this post


Link to post
Share on other sites
Valuater

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

Share this post


Link to post
Share on other sites
JetsterDajet

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!

Share this post


Link to post
Share on other sites
Valuater

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

Welcome...

And Welcome to the Autoit Forums

8)


NEWHeader1.png

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.