Sign in to follow this  
Followers 0
Oniris

MsgBox Return Values

3 posts in this topic

Hi, I know how to get the return value of a button in a gui :

#include <GUIConstants.au3>

GUICreate("OK", 110, 60) ; will create a dialog box that when displayed is centered

GUISetState ()

Opt("GUICoordMode",2)

$OK = GUICtrlCreateButton ("OK", 5, 5, 100,50)

While 1

$msg = GUIGetMsg()

If $msg = $OK THEN

MsgBox(0, "OK pressed","You pressed ok")

ENDIF

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

But how do I detect the "OK" in the message box that follows?

Sorry for the newb question, but I didn't find it in the message box function reference

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <GUIConstants.au3>
GUICreate("OK", 110, 60) ; will create a dialog box that when displayed is centered
GUISetState ()
Opt("GUICoordMode",2)
$OK = GUICtrlCreateButton ("OK", 5, 5, 100,50)

While 1

$msg = GUIGetMsg()

If $msg = $OK THEN
$result = MsgBox(0, "OK pressed","You pressed ok")
MsgBox(0, $result, $result)
ENDIF

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

Wend

For possible return values: http://www.autoitscript.com/autoit3/docs/ :D

Edited by marfdaman

Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

Perfect marfdaman, Thank you :D

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