Sign in to follow this  
Followers 0
Infinitex0

Need help

5 posts in this topic

#include <GUIConstants.au3>

GUICreate("Formula Machine 1.0",         240, 125)
$Tri = GUICtrlCreateButton("Triangles", 1,   1)
$Squ = GUICtrlCreateButton("Squares",     1, 100)
$Rec = GUICtrlCreateButton("Rectangle",   80,  50)
GUISetState(@SW_SHOW)


GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
       Case $msg = $Tri
GUICreate("Calculate Area Of Triangle", 125, 125)
GUICtrlCreateLabel("Input", -1, -1)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$btnB = GUICtrlCreateInput("Base",   10,  35, 50, 20) ; will not accept drag&drop files
$btnH = GUICtrlCreateInput("Height",   10,  60, 50, 20)
$btn1 = GUICtrlCreateButton ("Ok",   10,  90, 60, 20)

GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
       Case $msg = $btn1
ExitLoop
EndSelect
WEnd
MsgBox (4096, "Area ='s", GUICtrlRead($btnB)*GUICtrlRead($btnH)/2)

Case $msg = $Squ
GUICreate("Formula For Area Of Square", 125, 125)
GUICtrlCreateLabel("Input", -1, -1)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$btnS = GUICtrlCreateInput( "Side", 10, 35, 50, 20)
$btn2 = GUICtrlCreateButton("Ok",   10, 60, 50, 20)

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
           Case $msg = $btn2
MsgBox (4096, "Area ='s", GUICtrlRead($btnS)*GUICtrlRead($btnS))
EndSelect
WEnd
EndSelect
WEnd

GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
       Case $msg = $Rec
GUICreate("Calculate Area Of Rectangle", 125, 125)
GUICtrlCreateLabel("Input", -1, -1)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$btnD = GUICtrlCreateInput("A",      10,  35, 50, 20) ; will not accept drag&drop files
$btnD2 = GUICtrlCreateInput("B",        10,  60, 50, 20)
$btnZ = GUICtrlCreateButton ("Ok",    50,  90, 60, 20)

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
           Case $msg = $btnZ
MsgBox (4096, "Area ='s", GUICtrlRead($btnD)*GUICtrlRead($btnD2))
EndSelect
WEnd
EndSelect
WEnd

Whenever I press the Rectangle button nothing happens. Any idea why? :o


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites



you are creating your GUI's inside a while loop, which creates them over and over

creategui 1

creategui 2

while

wend

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

GUICreate("Formula Machine 1.0",         240, 125)
$Tri = GUICtrlCreateButton("Triangles", 1,   1)
$Squ = GUICtrlCreateButton("Squares",     1, 100)
$Rec = GUICtrlCreateButton("Rectangle",   80,  50)
GUISetState(@SW_SHOW)
GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
       Case $msg = $Tri
GUICreate("Calculate Area Of Triangle", 125, 125)
GUICtrlCreateLabel("Input", -1, -1)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$btnB = GUICtrlCreateInput("Base",   10,  35, 50, 20); will not accept drag&drop files
$btnH = GUICtrlCreateInput("Height",   10,  60, 50, 20)
$btn1 = GUICtrlCreateButton ("Ok",   10,  90, 60, 20)

GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
       Case $msg = $btn1
ExitLoop
EndSelect
WEnd
MsgBox (4096, "Area ='s", GUICtrlRead($btnB)*GUICtrlRead($btnH)/2)

Case $msg = $Squ
GUICreate("Formula For Area Of Square", 125, 125)
GUICtrlCreateLabel("Input", -1, -1)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$btnS = GUICtrlCreateInput( "Side", 10, 35, 50, 20)
$btn2 = GUICtrlCreateButton("Ok",   10, 60, 50, 20)

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
           Case $msg = $btn2
MsgBox (4096, "Area ='s", GUICtrlRead($btnS)*GUICtrlRead($btnS))
EndSelect
WEnd
EndSelect
WEnd

GUISetState () 

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
       Case $msg = $Rec
GUICreate("Calculate Area Of Rectangle", 125, 125)
GUICtrlCreateLabel("Input", -1, -1)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$btnD = GUICtrlCreateInput("A",      10,  35, 50, 20); will not accept drag&drop files
$btnD2 = GUICtrlCreateInput("B",        10,  60, 50, 20)
$btnZ = GUICtrlCreateButton ("Ok",    50,  90, 60, 20)

GUISetState ()

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
       $msg = GUIGetMsg()
       Select
           Case $msg = $btnZ
MsgBox (4096, "Area ='s", GUICtrlRead($btnD)*GUICtrlRead($btnD2))
EndSelect
WEnd
EndSelect
WEnd

Whenever I press the Rectangle button nothing happens. Any idea why? :o

Strange...It worked for me...

[quote] Gilbertson's Law: Nothing is foolproof to a sufficiently talented fool.Sandro Alvares: Flaxcrack is please not noob! i can report you is stop stupid. The Post[/quote]I made this: FWD & MD5PWD()

Share this post


Link to post
Share on other sites

i'm not sure how this is supposed to work but

#include <GUIConstants.au3>
GUICreate("Formula Machine 1.0",         240, 125)
$Tri = GUICtrlCreateButton("Triangles", 1,   1)
$Squ = GUICtrlCreateButton("Squares",     1, 100)
$Rec = GUICtrlCreateButton("Rectangle",   80,  50)
GUISetState(@SW_SHOW)
GUISetState ()
$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select
        Case $msg = $Tri
            GUICreate("Calculate Area Of Triangle", 125, 125)
            GUICtrlCreateLabel("Input", -1, -1)
            GUICtrlSetState(-1,$GUI_ACCEPTFILES)
            $btnB = GUICtrlCreateInput("Base",   10,  35, 50, 20); will not accept drag&drop files
            $btnH = GUICtrlCreateInput("Height",   10,  60, 50, 20)
            $btn1 = GUICtrlCreateButton ("Ok",   10,  90, 60, 20)
            GUISetState ()
            $msg = 0
            While $msg <> $GUI_EVENT_CLOSE
                $msg = GUIGetMsg()
                Select
                    Case $msg = $btn1
                        ExitLoop
                EndSelect
            WEnd
            MsgBox (4096, "Area ='s", GUICtrlRead($btnB)*GUICtrlRead($btnH)/2)
        Case $msg = $Squ
            GUICreate("Formula For Area Of Square", 125, 125)
            GUICtrlCreateLabel("Input", -1, -1)
            GUICtrlSetState(-1,$GUI_ACCEPTFILES)
            $btnS = GUICtrlCreateInput( "Side", 10, 35, 50, 20)
            $btn2 = GUICtrlCreateButton("Ok",   10, 60, 50, 20)
            GUISetState ()
            $msg = 0
            While $msg <> $GUI_EVENT_CLOSE
                $msg = GUIGetMsg()
                Select
                    Case $msg = $btn2
                        MsgBox (4096, "Area ='s", GUICtrlRead($btnS)*GUICtrlRead($btnS))
                EndSelect
            WEnd
        Case $msg = $Rec
            GUICreate("Calculate Area Of Rectangle", 125, 125)
            GUICtrlCreateLabel("Input", -1, -1)
            GUICtrlSetState(-1,$GUI_ACCEPTFILES)
            $btnD = GUICtrlCreateInput("A",      10,  35, 50, 20); will not accept drag&drop files
            $btnD2 = GUICtrlCreateInput("B",        10,  60, 50, 20)
            $btnZ = GUICtrlCreateButton ("Ok",    50,  90, 60, 20)
            GUISetState ()
            $msg = 0
            While $msg <> $GUI_EVENT_CLOSE
                $msg = GUIGetMsg()
                Select
                    Case $msg = $btnZ
                        MsgBox (4096, "Area ='s", GUICtrlRead($btnD)*GUICtrlRead($btnD2))
                EndSelect
            WEnd
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Like this

#include <GUIConstants.au3>
$Main = GUICreate("Formula Machine 1.0", 240, 125)
$Tri = GUICtrlCreateButton("Triangles", 1, 1)
$Squ = GUICtrlCreateButton("Squares", 1, 100)
$Rec = GUICtrlCreateButton("Rectangle", 80, 50)
GUISetState(@SW_SHOW)
GUISetState()


$triangle = GUICreate("Calculate Area Of Triangle", 125, 125)
GUICtrlCreateLabel("Input", -1, -1)
GUICtrlSetState(-1, $GUI_ACCEPTFILES)
$btnB = GUICtrlCreateInput("Base", 10, 35, 50, 20); will not accept drag&drop files
$btnH = GUICtrlCreateInput("Height", 10, 60, 50, 20)
$btn1 = GUICtrlCreateButton("Ok", 10, 90, 60, 20)
GUISetState()
$msg = 0
GUISetState(@SW_HIDE)

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
    Select
        Case $msg = $Tri
            GUISetState(@SW_SHOW, $triangle)
            
        Case $msg = $btn1
            GUISetState(@SW_HIDE, $triangle)
            
    EndSelect
WEnd

8)

Edited by Valuater

NEWHeader1.png

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