atzoref Posted February 8, 2012 Posted February 8, 2012 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.
UEZ Posted February 8, 2012 Posted February 8, 2012 (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") EndIfThe documentation for MsgBox in the help file is very useful. Br,UEZ Edited February 8, 2012 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
atzoref Posted February 8, 2012 Author Posted February 8, 2012 You don't understand me, I don't want "MsgBox" I want it will raise another GUI which I made...(like what I wrote)
Guest Posted February 8, 2012 Posted February 8, 2012 (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 February 8, 2012 by Guest
atzoref Posted February 8, 2012 Author Posted February 8, 2012 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)
Guest Posted February 8, 2012 Posted February 8, 2012 (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 February 8, 2012 by Guest
atzoref Posted February 8, 2012 Author Posted February 8, 2012 Maybe it is not works for me because I already inside (GUICtrlSetOnEvent) function?So that could be a reason that the "Switch GUIGetMsg()" will not work for me?If Yes how can I solve that?
jWalker Posted February 8, 2012 Posted February 8, 2012 Do sumthin like this. While 1 ... WEnd ..............^........ change this to: While 1 Switch $ActiveGUI Case "Main" .... If $ButtonOrOtherThingsToActivateOtherGUI Then $ActiveGUI = "Second" EndIf Case "Second" If $ButtonOrOtherThingsToActivateMainGUI Then $ActiveGUI = "Main" EndIf EndSwitch WEnd
atzoref Posted February 8, 2012 Author Posted February 8, 2012 (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 February 8, 2012 by atzoref
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now