Sign in to follow this  
Followers 0
XTensionX

making button work

5 posts in this topic

here is mu GUI

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 334, 206, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 16, 40, 129, 49, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button2", 176, 40, 145, 49, $WS_GROUP)
GUISetState(@SW_SHOW)


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

    EndSwitch
WEnd

how can i get my button to work?

want to add simple stuff like

MsgBox(4096,"Test", "hello")

MsgBox(4096,"Test", "Bye")

in each button

thanks

Share this post


Link to post
Share on other sites



All you do is add the case for the control

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 334, 206, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 16, 40, 129, 49, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Button2", 176, 40, 145, 49, $WS_GROUP)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            MsgBox(4096,"Test", "hello")
        Case $Button2
            MsgBox(4096,"Test", "Bye")
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites

its working

dats something new i learnt today

thanks ^^

Share this post


Link to post
Share on other sites

I usually prefer to set GuiOnEventMode to 1 and use GuiCtrlSetOnEvent.


The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

Share this post


Link to post
Share on other sites

onevent!!! YEAH!!

lol i love that... THOUGH i sometimes add Guigetmsg and setonevent 0 in certain functions to clean it up... but overall i prefer onevent

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