charon Posted February 2, 2015 Posted February 2, 2015 How can I create another GUI within my GUI. Example: I have a menu in my GUI called options. Click options to set preferences which require several input and drop down boxes so I created another GUI. When I close the 2nd GUI it closes everything instead of going back to the main GUI. Here is an example: expandcollapse popup#include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example") Local $iOK = GUICtrlCreateButton("OK", 310, 370, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ;Start top menu $OptionMenu = GUICtrlCreateMenu("&Options") $testitem = GUICtrlCreateMenuItem("Global", $OptionMenu) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $iOK ExitLoop Case $testitem SetOptions() EndSwitch ;If $msg = $testitem Then ;MsgBox($MB_SYSTEMMODAL, "test", "testing...") ;HotKeySet("^x", "RemedyFunc") ; SetOptions() ;EndIf WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example ;GUI Functions Func SetOptions() Local $msg, $sItem GUICreate("Options", 380, 230, 100, 200, -1) ;5 buttons width/height/left/top GUICtrlCreateLabel("Delay ", 10, 10, 40) ; first cell 70 width $Input = GUICtrlCreateInput("500", 50, 10, 40, 20) ;left/top/width/height GUICtrlSetState(-1, $GUI_FOCUS) ; the focus is on this button Local $Go = GUICtrlCreateButton("Go", 120, 10, 85, 25) GUISetState(@SW_SHOW) ; will display an empty dialog box with a combo control with focus on ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd EndFunc
Moderators Melba23 Posted February 2, 2015 Moderators Posted February 2, 2015 Charon,I recommend reading the Managing Multiple GUIs tutorial in the Wiki. 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
MikahS Posted February 2, 2015 Posted February 2, 2015 It's because it's finishing the script after the second function. Have a look at what Melba suggested and I'm sure you will find your way. Anymore questions post script and we'll be sure to help. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
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