Jump to content

Recommended Posts

Posted

Hi,

How can I make a function which raise another little "Popup" GUI

which has a button so when it be pressed so the popup will closed

and the function eill return a specific value which indicates the button was pressed

Thanks.

Posted (edited)

Here an example:

$iMsgBox = MsgBox(4, "Test", "Press one of the buttons")
If $iMsgBox = 6 Then
    MsgBox(0, "Result", "Yes was pressed")
Else
    MsgBox(0, "Result", "No was pressed")
EndIf

The documentation for MsgBox in the help file is very useful. :)

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted (edited)

You mean something like this.

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

MsgBox(0,"Returned value",Gui2())

Func Gui2()
Local $msg

GUICreate("My GUI2") ; will create a dialog box that when displayed is centered
$btnC = GUICtrlCreateButton("close",30,30,100,30)
GUISetState(@SW_SHOW) ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
Switch GUIGetMsg()
   case $btnC
 GUIDelete()
 MsgBox(0,"","Button pressed")
 Return 1
   case $GUI_EVENT_CLOSE
 ExitLoop
EndSwitch

WEnd
GUIDelete()
Return 0
EndFunc
Edited by Guest
Posted

Aipion:

Yes.

I try something like that before, but somehow the case statements not run for me, why is that?

(it seems that it is stuck in the While 1 loop)

Posted (edited)

Aipion:

Yes.

I try something like that before, but somehow the case statements not run for me, why is that?

(it seems that it is stuck in the While 1 loop)

Is it possibly for me to see the code that went wrong with the case statements but the one made should work just fine.

Edited by Guest
Posted (edited)

I think it now work because I set:

AutoItSetOption("GUIOnEventMode", 1)

When I set it to "0" it works good.

The problem is:

I am already inside a running function of a GUICtrlSetOnEvent of a button,

during its process I am rasinig this PopUP Gui

So if I still in: AutoItSetOption("GUIOnEventMode", 1)

I cannot running inside ( GUICtrlSetOnEvent) of the PopUp GUI

And If Changing inside the Popup GUI to AutoItSetOption("GUIOnEventMode", 0)

It works but for example the main script cannot be Stop Executing when close because it be setted to "0"

How can I solve that?

Edited by atzoref

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
×
×
  • Create New...