Jump to content
Sign in to follow this  
bills4

how to read data of GUICtrlCreateCombo

Recommended Posts

bills4

i have this program 

#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1_1 = GUICreate("check cvv sony v1.1", 379, 155, 438, 309)
$Combo1 = GUICtrlCreateCombo("", 32, 24, 161, 25,BitOR($WS_VSCROLL,$ES_READONLY,$CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetBkColor(-1,0xFFFFFF)
GUISetState(@SW_SHOW)
$CHECK_NOW = GUICtrlCreateButton("CHECK", 264, 16, 81, 49)
#EndRegion ### END Koda GUI section ###


$list = GUICtrlSetData($Combo1,"item1|item2|item3","item1")
$item = GUICtrlRead($list)



While 1
$MSG = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $MSG = $CHECK_NOW
Check()
EndSelect
WEnd

Func Check()
   MsgBox(0, "Bang thong bao:", $item)
   EndFunc

i want when user choose item and click check then it will show value user choose

example you choose item2, when click check , it will show item2

Share this post


Link to post
Share on other sites
FireFox

Func Check()
$item = GUICtrlRead($list)
MsgBox(0, "Bang thong bao:", $item)
EndFunc

And... read the helpfile.

  • Like 1

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
bills4

not working

can you help detail ?

Share this post


Link to post
Share on other sites
ZacUSNYR

You're checking the list and not the control.  

You need to check the control within the loop (otherwise you won't know it changed).  You can do this check in your function.  I'm a fan of keeping as much stuff in local scope in the Functions so i'd pass the control to the function and have it check the control.

#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1_1 = GUICreate("check cvv sony v1.1", 379, 155, 438, 309)
$Combo1 = GUICtrlCreateCombo("", 32, 24, 161, 25,BitOR($WS_VSCROLL,$ES_READONLY,$CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetBkColor(-1,0xFFFFFF)
GUISetState(@SW_SHOW)
$CHECK_NOW = GUICtrlCreateButton("CHECK", 264, 16, 81, 49)
#EndRegion ### END Koda GUI section ###
 
 
GUICtrlSetData($Combo1,"item1|item2|item3","item1")
 
 
 
 
While 1
$MSG = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $MSG = $CHECK_NOW
Check($Combo1)
EndSelect
WEnd
 
Func Check($hCtrl)
   MsgBox(0, "Bang thong bao:", GUICtrlRead($hCtrl))
EndFunc
  • Like 1

Share this post


Link to post
Share on other sites
FireFox

He's right.

The $list variable is useless here.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

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  

×