=sinister= Posted March 16, 2007 Share Posted March 16, 2007 (edited) ><.... Not sure where to start. I want to create 2 GUI's. #Include <GUIConstants.au3> $GUI = GUICreate($Name, 300, 300, -1, -1) $File = GUICtrlCreateMenu("File") $Open = GUICtrlCreateMenuItem("Open", $File) $Options = GUICtrlCreateMenu("Options") $Settings = GUICtrlCreateMenuItem("Settings", $Options) $Edit = GUICtrlCreateEdit("", 2, 25, 296, 225) GUISetState(@SW_Show, $GUI) While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_Event_Close Exit Case $Msg = $GUI_Event_Close GUISetState(@SW_Hide, $GUI_Settings) Case $Msg = $Open $Dialog = FileOpen(FileOpenDialog("Please Choose A File", @ScriptDir & "\", "Travel Files (*.trv)"), 0) If $Dialog = @Error Then ;Do Nothing Else $Read = FileRead($Dialog) GUICtrlSetData($Edit, $Read) EndIf Case $Msg = $Settings $GUI_Settings = GUICreate($Name & " " & "Settings", 150, 100, -1, -1) GUISetState(@SW_Show, $GUI_Settings) EndSelect WEnd The problem is I don't know how to get only 1 to close, and which one was closed. Any ideas? Edited March 16, 2007 by =sinister= Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted March 16, 2007 Share Posted March 16, 2007 (edited) try this.. [edit] i added some comments.. #Include <GUIConstants.au3> $Name = 'name' ; missing variable $GUI = GUICreate($Name, 300, 300, -1, -1) $File = GUICtrlCreateMenu("File") $Open = GUICtrlCreateMenuItem("Open", $File) $Options = GUICtrlCreateMenu("Options") $Settings = GUICtrlCreateMenuItem("Settings", $Options) $Edit = GUICtrlCreateEdit("", 2, 25, 296, 225) GUISetState(@SW_Show, $GUI) ;create gui once, and hide it $GUI_Settings = GUICreate($Name & " " & "Settings", 150, 100) GUISetState(@SW_HIDE, $GUI_Settings) While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_Event_Close ; you only need 1 event (2 or more of same event will be ingored.) If WinGetHandle('') = $GUI Then ;checks if the active window handle = $GUI Exit Else GUISetState(@SW_Hide, WinGetHandle('')) ;hide any extra windows by handle, you can change this to $GUI_Settings EndIf Case $Msg = $Open $Dialog = FileOpen(FileOpenDialog("Please Choose A File", @ScriptDir & "\", "Travel Files (*.trv)"), 0) If Not $Dialog = @Error Then ;the then do nothing was it needed? $Read = FileRead($Dialog) GUICtrlSetData($Edit, $Read) EndIf Case $Msg = $Settings GUISetState(@SW_SHOW, $GUI_Settings) ;show the gui_settings window EndSelect WEnd Edited March 17, 2007 by mrRevoked Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
=sinister= Posted March 17, 2007 Author Share Posted March 17, 2007 MrRevoked, This was exactly what I was looking for. Thank you!! I also appreciate you commenting the script to help me even more. That missing variable was part of another script. See I organize my scripts into certain files ><. I'm a neat freak. Anyways, thank you for the help. 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