superbosu Posted January 25, 2011 Posted January 25, 2011 (edited) #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $Button_1, $Button_2, $msg, $set1 GUICreate("BOSU TM", 300, 460) ; will create a dialog box that when displayed is centered Opt("GUICoordMode", 3) $Button_1 = GUICtrlCreateButton("Import", 50, 280, 100) $Button_2 = GUICtrlCreateButton("GES", 50, 320, 100) $set1 = GUICtrlCreateInput("CR", 180, 281, 70, 23) GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 $set1 = GUICtrlRead($set1, 0) MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$set1' & @lf & @lf & 'Return:' & @lf & $set1) ;### Debug MSGBOX Case $msg = $Button_2 MsgBox(0, 'Testing', 'Button 2 was pressed') ; Will demonstrate Button 2 being pressed EndSelect WEnd EndFunc ;==>ExampleHi all, I have a probelm with my simple code..... This application works only the first time if I write something on the imput box after click on button 1 again, the msg is always 0 .... why? Who can help me? Edited January 25, 2011 by superbosu
kaotkbliss Posted January 25, 2011 Posted January 25, 2011 (edited) You are re-declaring $set1 so it is no longer the handle for the control simply change $set1 = GUICtrlRead($set1, 0) to $set2 = GUICtrlRead($set1, 0) and MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$set1' & @lf & @lf & 'Return:' & @lf & $set1) to MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$set1' & @lf & @lf & 'Return:' & @lf & $set2) and add $set2 to your local variables Edited January 25, 2011 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
superbosu Posted January 25, 2011 Author Posted January 25, 2011 You are re-declaring $set1 so it is no longer the handle for the controlsimply change$set1 = GUICtrlRead($set1, 0)to$set2 = GUICtrlRead($set1, 0)andMsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$set1' & @lf & @lf & 'Return:' & @lf & $set1)toMsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$set1' & @lf & @lf & 'Return:' & @lf & $set2)and add $set2 to your local variablesTnx it works
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