Small Posted May 27, 2016 Share Posted May 27, 2016 So i made a GUI and added an other GUI inside. when i press a button in the main GUI the following GUI will popup: expandcollapse popup$gReconnect = GUICreate("Reconnect", 220, 164) GUICtrlCreateLabel("Email",2,2,201,21) $Email = GUICtrlCreateInput("", 2, 17, 201, 21) GUICtrlCreateLabel("Password",2,42,201,21) $Password = GUICtrlCreateInput("", 2, 57, 201, 21,$ES_PASSWORD) GUICtrlCreateLabel("Character Name",2,82,201,21) $Charrname = GUICtrlCreateInput("", 2, 97, 201, 21) $grsave = GUICtrlCreateButton("Save",2,142,106,21) $grcancel = GUICtrlCreateButton("Cancel",112,142,106,21) $grload = GUICtrlCreateButton("Load ini file",2,120,106,21) $grselect = GUICtrlCreateCombo("",113,120,104,15) GUICtrlSetOnEvent($grsave, "ReconnectHandler") GUISetOnEvent($GUI_EVENT_CLOSE, "ReconnectHandler") GUICtrlSetOnEvent($grcancel, "ReconnectHandler") GUICtrlSetOnEvent($grload, "ReconnectHandler") GUICtrlSetOnEvent($grselect, "ReconnectHandler") GUISetState(@SW_HIDE) Func ReconnectHandler() Switch (@GUI_CtrlId) Case $grload Case $grselect Case $grcancel $MBCANCEL = MsgBox($MB_YESNO,"Are you sure?","Are you sure you want to cancel the input?") If $MBCANCEL = 6 Then GUIReconnect() EndIf Case $GUI_EVENT_CLOSE GUIReconnect() Case $grsave MsgBox(0,"Saved!", "The settings are saved") GUIReconnect() EndSwitch EndFunc The problem here is when i close the GUI it works but when i try to click a button nothing happends. I dont know why but the main GUI works perfect. EDIT: Yes i added OPT("GUIOnEventMode, 1) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2016 Moderators Share Posted May 27, 2016 Small, Without sight of the whole script there is not much we can do to help - but this small script of mine incorporating your functions seems to work without problem: expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Opt("GUIOnEventMode", 1) $hGUI = GUICreate("Test", 500, 500) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUICtrlCreateButton("Show", 10, 10, 80, 30) GUICtrlSetOnEvent(-1, "_ShowGUI") GUICtrlCreateButton("Test", 10, 50, 80, 30) GUICtrlSetOnEvent(-1, "_Test") GUISetState() $gReconnect = GUICreate("Reconnect", 220, 164) GUISetOnEvent($GUI_EVENT_CLOSE, "ReconnectHandler") $grsave = GUICtrlCreateButton("Save",2,142,106,21) $grcancel = GUICtrlCreateButton("Cancel",112,142,106,21) $grload = GUICtrlCreateButton("Load ini file",2,120,106,21) $grselect = GUICtrlCreateCombo("",113,120,104,15) GUICtrlSetOnEvent($grsave, "ReconnectHandler") GUICtrlSetOnEvent($grcancel, "ReconnectHandler") GUICtrlSetOnEvent($grload, "ReconnectHandler") GUICtrlSetOnEvent($grselect, "ReconnectHandler") GUISetState(@SW_HIDE) While 1 Sleep(10) WEnd Func _ShowGUI() GUISetState(@SW_SHOW, $gReconnect) EndFunc Func ReconnectHandler() Switch (@GUI_CtrlId) Case $grload MsgBox($MB_SYSTEMMODAL, "Load", "Pressed") Case $grselect MsgBox($MB_SYSTEMMODAL, "Select", "Pressed") Case $grcancel MsgBox($MB_SYSTEMMODAL, "Cancel", "Pressed") Case $GUI_EVENT_CLOSE MsgBox($MB_SYSTEMMODAL, "[X]", "Pressed") GUISetState(@SW_HIDE, $gReconnect) Case $grsave MsgBox($MB_SYSTEMMODAL, "Save", "Pressed") EndSwitch EndFunc Func _Exit() Exit EndFunc Func _Test() MsgBox($MB_SYSTEMMODAL, "Test", "Pressed") EndFunc M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Small Posted May 27, 2016 Author Share Posted May 27, 2016 (edited) expandcollapse popup#include <Array.au3> #include <GuiStatusBar.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ScrollBarsConstants.au3> #include <Misc.au3> #include <EditConstants.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode",1) $GUIreconnect = False #Region $Form1_1 = GUICreate("Turtle by Small Version 2.3", 222, 280, 227, 334) $cCharrname = GUICtrlCreateCombo("", 5, 24, 212, 25, $CBS_DROPDOWN) ;~ GUICtrlSetData(-1,GetLoggedCharNames()) $Status = GUICtrlCreateLabel("Character name", 5, 5, 79, 17) $Log = GUICtrlCreateEdit("", 2, 120, 218, 100, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL)) $bStart = GUICtrlCreateButton("Start", 2, 232, 218, 25) $mMenu = GUICtrlCreateMenu("Menu") $mStop = GUICtrlCreateMenuItem("Stop", $mMenu) $mRender = GUICtrlCreateMenuItem("Rendering", $mMenu) $mReconnect = GUICtrlCreateMenuItem("Reconnect", $mMenu) GUICtrlSetOnEvent($bStart, "GUIHandler") GUISetOnEvent($GUI_EVENT_CLOSE, "GUIHandler") GUICtrlSetOnEvent($mStop, "GUIHandler") GUICtrlSetOnEvent($mRender, "GUIHandler") GUICtrlSetOnEvent($mReconnect, "GUIHandler") GUISetState(@SW_SHOW) $gReconnect = GUICreate("Reconnect", 220, 164) GUICtrlCreateLabel("Email",2,2,201,21) $Email = GUICtrlCreateInput("", 2, 17, 201, 21) GUICtrlCreateLabel("Password",2,42,201,21) $Password = GUICtrlCreateInput("", 2, 57, 201, 21,$ES_PASSWORD) GUICtrlCreateLabel("Character Name",2,82,201,21) $Charrname = GUICtrlCreateInput("", 2, 97, 201, 21) $grsave = GUICtrlCreateButton("Save",2,142,106,21) $grcancel = GUICtrlCreateButton("Cancel",112,142,106,21) $grload = GUICtrlCreateButton("Load ini file",2,120,106,21) $grselect = GUICtrlCreateCombo("",113,120,104,15) GUICtrlSetOnEvent($grsave, "ReconnectHandler") GUISetOnEvent($GUI_EVENT_CLOSE, "ReconnectHandler") GUICtrlSetOnEvent($grcancel, "ReconnectHandler") GUICtrlSetOnEvent($grload, "ReconnectHandler") GUICtrlSetOnEvent($grselect, "ReconnectHandler") GUISetState(@SW_HIDE) Func ReconnectHandler() Switch (@GUI_CtrlId) Case $grload MsgBox(0,"Load","Load was pressed") Case $grselect MsgBox(0,"Select","Select was pressed") Case $grcancel GUIReconnect() Case $GUI_EVENT_CLOSE GUIReconnect() Case $grsave MsgBox(0,"Save","Save was pressed"&@CRLF&"The GUI will now close") GUIReconnect() EndSwitch EndFunc Func GUIHandler() Switch (@GUI_CtrlId) Case $bStart MsgBox(0,"Start", "Start Button Was Pressed") Case $mStop, $GUI_EVENT_CLOSE Exit Case $mRender Case $mReconnect GUIReconnect() EndSwitch EndFunc ;==>GUIHandler Func GUIReconnect() If $GUIreconnect = True Then WinSetState($gReconnect,"Reconnect", @SW_HIDE) $GUIreconnect = False Else WinSetState($gReconnect,"Reconnect", @SW_SHOW) $GUIreconnect = True EndIf EndFunc #EndRegion While 1 sleep(100) WEnd This is the GUI that I use. The main GUI works perfect but the otherone doesn't Edited May 27, 2016 by Small Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2016 Moderators Share Posted May 27, 2016 Small, The problem is the GUIReconnect function - you need to use GUISetState rather then WinSetState: expandcollapse popup#include <Array.au3> #include <GuiStatusBar.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ScrollBarsConstants.au3> #include <Misc.au3> #include <EditConstants.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode", 1) $GUIreconnect = False $Form1_1 = GUICreate("Turtle by Small Version 2.3", 222, 280, 227, 334) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIHandler") $mMenu = GUICtrlCreateMenu("Menu") $mStop = GUICtrlCreateMenuItem("Stop", $mMenu) $mRender = GUICtrlCreateMenuItem("Rendering", $mMenu) $mReconnect = GUICtrlCreateMenuItem("Reconnect", $mMenu) $cCharrname = GUICtrlCreateCombo("", 5, 24, 212, 25, $CBS_DROPDOWN) $Status = GUICtrlCreateLabel("Character name", 5, 5, 79, 17) $Log = GUICtrlCreateEdit("", 2, 120, 218, 100, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_WANTRETURN, $WS_VSCROLL)) $bStart = GUICtrlCreateButton("Start", 2, 232, 218, 25) GUICtrlSetOnEvent($bStart, "GUIHandler") GUICtrlSetOnEvent($mStop, "GUIHandler") GUICtrlSetOnEvent($mRender, "GUIHandler") GUICtrlSetOnEvent($mReconnect, "GUIHandler") GUISetState(@SW_SHOW, $Form1_1) $gReconnect = GUICreate("Reconnect", 220, 164) GUISetOnEvent($GUI_EVENT_CLOSE, "ReconnectHandler") GUICtrlCreateLabel("Email", 2, 2, 201, 21) $Email = GUICtrlCreateInput("", 2, 17, 201, 21) GUICtrlCreateLabel("Password", 2, 42, 201, 21) $Password = GUICtrlCreateInput("", 2, 57, 201, 21, $ES_PASSWORD) GUICtrlCreateLabel("Character Name", 2, 82, 201, 21) $Charrname = GUICtrlCreateInput("", 2, 97, 201, 21) $grsave = GUICtrlCreateButton("Save", 2, 142, 106, 21) $grcancel = GUICtrlCreateButton("Cancel", 112, 142, 106, 21) $grload = GUICtrlCreateButton("Load ini file", 2, 120, 106, 21) $grselect = GUICtrlCreateCombo("", 113, 120, 104, 15) GUICtrlSetOnEvent($grsave, "ReconnectHandler") GUICtrlSetOnEvent($grcancel, "ReconnectHandler") GUICtrlSetOnEvent($grload, "ReconnectHandler") GUICtrlSetOnEvent($grselect, "ReconnectHandler") GUISetState(@SW_HIDE, $gReconnect) While 1 Sleep(10) WEnd Func ReconnectHandler() ConsoleWrite(@GUI_WinHandle & @CRLF) Switch @GUI_CtrlId Case $grload MsgBox($MB_SYSTEMMODAL, "Load", "Load was pressed") Case $grselect MsgBox($MB_SYSTEMMODAL, "Select", "Select was pressed") Case $grcancel MsgBox($MB_SYSTEMMODAL, "Cancel", "Cancel was pressed") GUIReconnect() Case $GUI_EVENT_CLOSE MsgBox($MB_SYSTEMMODAL, "[X]", "[X] was pressed") GUIReconnect() Case $grsave MsgBox($MB_SYSTEMMODAL, "Save", "Save was pressed" & @CRLF & "The GUI will now close") GUIReconnect() EndSwitch EndFunc ;==>ReconnectHandler Func GUIHandler() Switch (@GUI_CtrlId) Case $bStart MsgBox($MB_SYSTEMMODAL, "Start", "Start Button Was Pressed") Case $mStop, $GUI_EVENT_CLOSE Exit Case $mRender Case $mReconnect GUIReconnect() EndSwitch EndFunc ;==>GUIHandler Func GUIReconnect() If $GUIreconnect = True Then GUISetState(@SW_HIDE, $gReconnect) $GUIreconnect = False Else GUISetState(@SW_SHOW, $gReconnect) $GUIreconnect = True EndIf EndFunc ;==>GUIReconnect That works for me - does it for you? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Small Posted May 27, 2016 Author Share Posted May 27, 2016 (edited) Yeah it does now. I can bash my head into a wall rightnow..... Thanks M23 Edited May 27, 2016 by Small Link to comment Share on other sites More sharing options...
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