Mintz Posted May 31, 2007 Share Posted May 31, 2007 I have a simple problem where the user is to enter numerical info into for GUI edits, and press "calculate" and it should calculate the numerical info. The user is to leave one space with a ? in it and the script should calculate the other numbers accordingly. i have only Set the calculations so that the the first box may have a ?. Even with that set, Nothing is happening when i push the button. I'm wondering if i need the bitAND(GUIctrlread($Q), ??????) but i dont know what variable that should be if any. any help? #include<Guiconstants.au3> $name = Inputbox("Welcome", "Please enter your name") $1 = Guicreate($name, 400, 200) $button1 = GUICtrlCreateButton("Calculate!", 255, 130, 90, 50) $Q = GUICtrlCreateEdit("Enter Your Change in heat", 10, 10, 200, 20) $m = GUICtrlCreateEdit("Enter Your Mass", 10, 40, 200, 20) $c = GUICtrlCreateEdit("Enter Your Specific heat", 10, 70, 200, 20) $DT = GUICtrlCreateEdit("Enter Your Change in Temp.", 10, 100, 200, 20) GUICtrlCreateLabel("Change in Heat", 220, 10) GUICtrlCreateLabel("Mass", 220, 40) GUICtrlCreateLabel("Specific Heat", 220, 70) GUICtrlCreateLabel("Change in Temp.", 220, 100) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $button1 and $Q = "?" $Q1 = Abs($m * $c * $t) MsgBox(0, "Calculator:", "Your Change in heat is: " & $Q1) ExitLoop EndSelect WEnd Link to comment Share on other sites More sharing options...
BrettF Posted May 31, 2007 Share Posted May 31, 2007 Ok. Your missing quite a few GUICtrlRead(). Your while loop should look like something like this While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $button1 and GUICtrlRead ($Q) = "?" $Q1 = Abs(GUICtrlRead ($m) * GUICtrlRead ($c) * $t) MsgBox(0, "Calculator:", "Your Change in heat is: " & $Q1) ExitLoop EndSelect WEnd Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Valuater Posted May 31, 2007 Share Posted May 31, 2007 (edited) #include<Guiconstants.au3> $name = Inputbox("Welcome", "Please enter your name") $1 = Guicreate($name, 400, 200) $button1 = GUICtrlCreateButton("Calculate!", 255, 130, 90, 50) $Q = GUICtrlCreateEdit("Enter Your Change in heat", 10, 10, 200, 20) $m = GUICtrlCreateEdit("Enter Your Mass", 10, 40, 200, 20) $c = GUICtrlCreateEdit("Enter Your Specific heat", 10, 70, 200, 20) $DT = GUICtrlCreateEdit("Enter Your Change in Temp.", 10, 100, 200, 20) GUICtrlCreateLabel("Change in Heat", 220, 10) GUICtrlCreateLabel("Mass", 220, 40) GUICtrlCreateLabel("Specific Heat", 220, 70) GUICtrlCreateLabel("Change in Temp.", 220, 100) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $button1 and GUICtrlRead($Q) = "?" $Q1 = Abs(GUICtrlRead($m) * GUICtrlRead($c) * GUICtrlRead($dt)) MsgBox(0, "Calculator:", "Your Change in heat is: " & $Q1) ExitLoop EndSelect WEnd$Q1 = Abs(GUICtrlRead ($m) * GUICtrlRead ($c) * $t) ... is >>> $Q1 = Abs(GUICtrlRead ($m) * GUICtrlRead ($c) * $Dt)8) Edited May 31, 2007 by Valuater Link to comment Share on other sites More sharing options...
Mintz Posted May 31, 2007 Author Share Posted May 31, 2007 Thank you. This place is so helpfull. 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