Sign in to follow this  
Followers 0
Evil_Has_Survived

Simple Gui Question

2 posts in this topic

how do I set a event for a botton, in a GUI box example

#include <GUIConstants.au3>

GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered

Opt("GUICoordMode",2)
GUICtrlCreateButton ("OK",  10, 30, 50)
GUICtrlCreateButton ( "Cancel",  0, -1)

EndIf 
clicked 
send("{EXIT}")

something like that please

I am trying to mess with this

#include <GUIConstants.au3>

GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered

Opt("GUICoordMode",2)
GUICtrlCreateButton ("OK",  10, 30, 50)
GUICtrlCreateButton ( "Cancel",  0, -1)

GUISetState ()    ; will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

it might help me


Thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

there is no GUIGetMsg() used with on event

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

GUICreate("MY GUI",220,200, 100,200)
GUISetBkColor (0x00E0FFFF); will change background color
GUISetOnEvent($GUI_EVENT_CLOSE, "Leave"); to handle click on button
$button = GUICtrlCreateButton ("event",75,170,70,20)
GUICtrlSetOnEvent(-1, "onclick"); to handle click on button
GUISetState()

While 1
   Sleep (100)
Wend

Exit

Func onclick()
    MsgBox(64,"event", "this was triggered by an event")
 ;do stuff
EndFunc

Func Leave()
 ; special action before exiting
  Exit
EndFunc

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