Jump to content

Need help with simple gui


Recommended Posts

1 minute ago, dwarf said:

i am making a simple gui that changes the background color of the window when a button is pressed , but every time i press one it closes , my question is how do i get to stay open after i press a button ?

simplegui.au3 1.06 kB · 1 download

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 437, 192, 124)
GUISetBkColor(0xFF0000)
Global $Button1 = GUICtrlCreateButton("Red", 184, 32, 75, 25)
Global $Button2 = GUICtrlCreateButton("Green", 448, 32, 75, 25)
Global $Button3 = GUICtrlCreateButton("White", 96, 32, 75, 25)
Global $Button4 = GUICtrlCreateButton("Yellow", 360, 32, 75, 25)
Global $Button5 = GUICtrlCreateButton("Blue", 272, 32, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Button1
            Exit

        Case $Button2
            Exit

        Case $Button3
            Exit

        Case $Button4
            Exit

        Case $Button5
            Exit
    EndSwitch
WEnd

Func Red()
    GUISetBkColor(0xFF0000)
EndFunc
Func Blue()
    GUISetBkColor(0xFF0000)
EndFunc
Func Yellow()
    GUISetBkColor(0xFF0000)
EndFunc
Func Green()
    GUISetBkColor(0xFF0000)
EndFunc
Func White()
    GUISetBkColor(0xFF0000)
EndFunc

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...