Sign in to follow this  
Followers 0
Mintz

Simple GUI problem

4 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Thank you. This place is so helpfull.

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  
Followers 0