PedroAika Posted May 22, 2014 Share Posted May 22, 2014 (edited) Hi guys, i'm having some struggles.. Can you guys help me? thx! I wanna creat a normal program. So i did this #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 348, 96, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 32, 24, 121, 21) $Input2 = GUICtrlCreateInput("Input2", 208, 24, 121, 21) $Button1 = GUICtrlCreateButton("Button1", 152, 56, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $input1 $input2 $soma = $input1 + $input2 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(64,"Soma","A soma é" $soma) EndSwitch WEnd What should i do, to show the $soma value, in the MsgBox? I'm trying. but i cant find a way of doing it. Edited May 22, 2014 by PedroAika Link to comment Share on other sites More sharing options...
Malkey Posted May 22, 2014 Share Posted May 22, 2014 Try this. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $Form1, $Input1, $Input2, $Button1, $nMsg, $soma #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 348, 96, 192, 124) $Input1 = GUICtrlCreateInput("11", 32, 24, 121, 21, $ES_NUMBER) ; $Input1 contains the automatically assigned id of the control. (see help file) $Input2 = GUICtrlCreateInput("12", 208, 24, 121, 21, $ES_NUMBER) ; $ES_NUMBER is "style" parameter of GUICtrlCreateInput. (see help file) $Button1 = GUICtrlCreateButton("Button1", 152, 56, 75, 25) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $soma = GUICtrlRead($Input1) + GUICtrlRead($Input2) ; Note this line is placed inside While-Wend loop, so $soma is up to date. MsgBox(64, "Soma", '$soma contains "' & $soma & '".') ; "&" concatenate strings. EndSwitch WEnd Link to comment Share on other sites More sharing options...
November Posted May 22, 2014 Share Posted May 22, 2014 Hi there, And adding an update to Malkey code, to clear the last input values for next loop #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Soma", 348, 96, 192, 124) $Input1 = GUICtrlCreateInput("", 32, 24, 121, 21) $Input2 = GUICtrlCreateInput("", 208, 24, 121, 21) $Button1 = GUICtrlCreateButton("Somar", 152, 56, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $soma = GUICtrlRead($Input1) + GUICtrlRead($Input2) MsgBox(64, "Soma", "A soma é " & $soma) GUICtrlSetData($Input1, "") GUICtrlSetData($Input2, "") EndSwitch WEnd Cheers. Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
PedroAika Posted May 23, 2014 Author Share Posted May 23, 2014 thank you guys! 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