Jump to content

About button,help me


Recommended Posts

(Sorry about my bad E first).So i want code a script when i click on a button then dislay a message box.But i dont know how to code.I tried to code a script but it's incomplete.Anyone can help me ? thx in advance!

#include <GUIConstantsEx.au3>
Func test()
Global $check
GUICreate("alert",300,100)
$check = GUICtrlCreateButton("Confirm",100,50,100,30)
; here is my problem, i dont know how to code
If GUIGetMsg() Then 
    MsgBox(0,"alet","ok")
EndIf

GUISetState()

While 1
    If GUIGetMsg() == $GUI_EVENT_CLOSE Then ExitLoop
WEnd

EndFunc

test()
Link to comment
Share on other sites

Listen for a message in the loop...

#include <GUIConstantsEx.au3>

Global $check

test()

Func test()

    GUICreate("alert", 300, 100)
    $check = GUICtrlCreateButton("Confirm", 100, 50, 100, 30)
    GUISetState()

    While 1
        
        $Msg = GUIGetMsg()
        
        If $Msg = $GUI_EVENT_CLOSE Then ExitLoop
        
        If $Msg = $check Then
            MsgBox(0, "alet", "ok")
        EndIf
        
    WEnd

EndFunc   ;==>test

8)

NEWHeader1.png

Link to comment
Share on other sites

Link to comment
Share on other sites

Thx everybody but i just dont understand why GUIGetMsg() function can listen event of GUICtrlCreateButton() ?? GUICtrlCreateButton() return id of control ?? and GUIGetMsg() return any event have occurred that have a list in help file ?

Link to comment
Share on other sites

Thx everybody but i just dont understand why GUIGetMsg() function can listen event of GUICtrlCreateButton() ?? GUICtrlCreateButton() return id of control ?? and GUIGetMsg() return any event have occurred that have a list in help file ?

GuiGetMsg() CAN and IS listening for the even of the button created with GuiCtrlCreateButton()

It just needs to be in a loop, meaning it has to be consistently checked...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...