bills4 Posted October 30, 2013 Share Posted October 30, 2013 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 Link to comment Share on other sites More sharing options...
FireFox Posted October 30, 2013 Share Posted October 30, 2013 Func Check() $item = GUICtrlRead($list) MsgBox(0, "Bang thong bao:", $item) EndFunc And... read the helpfile. bills4 1 Link to comment Share on other sites More sharing options...
bills4 Posted October 30, 2013 Author Share Posted October 30, 2013 not working can you help detail ? Link to comment Share on other sites More sharing options...
ZacUSNYR Posted October 30, 2013 Share Posted October 30, 2013 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 bills4 1 Link to comment Share on other sites More sharing options...
FireFox Posted October 30, 2013 Share Posted October 30, 2013 He's right. The $list variable is useless here. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now