soulhealer Posted July 19, 2006 Posted July 19, 2006 (edited) hi, i made a simple sub gui window, but when i close that sub gui window, the main gui window, doesn't work anymore a.k.a i can't control it anymore, though it still there.here's my script:#include <GuiConstants.au3>GuiCreate("MyGUI", 235, 76,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))$Button_1 = GuiCtrlCreateButton("Continue", 10, 20, 100, 30)$Button_2 = GuiCtrlCreateButton("Cancel", 130, 20, 100, 30)GuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg = $Button_2 OR $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Gui2() Case Else ;;; EndSelectWEndExitFunc Gui2()GuiCreate("MyGUI", 168, 81,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))$Button_1 = GuiCtrlCreateButton("Close Gui2 Only", 10, 20, 140, 40)GuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg = $Button_1 OR $msg = $GUI_EVENT_CLOSE GuiDelete() Case Else ;;; EndSelectWEndEndFuncthank's for any help. :">sorry if the english isn't so good. Edited July 19, 2006 by soulhealer
Valuater Posted July 19, 2006 Posted July 19, 2006 this is one way #include <GuiConstants.au3> $G1 = GUICreate("MyGUI", 235, 76, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Button_1 = GUICtrlCreateButton("Continue", 10, 20, 100, 30) $Button_2 = GUICtrlCreateButton("Cancel", 130, 20, 100, 30) GUISetState() $G2 = GUICreate("MyGUI", 168, 81, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Button_1A = GUICtrlCreateButton("Close Gui2 Only", 10, 20, 140, 40) GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg() Select Case $msg = $Button_2 Or $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 GUISetState(@SW_SHOW, $G2) Case $msg = $Button_1A GUISetState(@SW_HIDE, $G2) Case Else ;;; EndSelect WEnd Exit 8)
soulhealer Posted July 19, 2006 Author Posted July 19, 2006 Thanks alot, this is exactly what i need to know
Blackstar Posted July 20, 2006 Posted July 20, 2006 I wanted to add a question that is closely related to this post that how darn do you keep that sub gui REMAIN and ALWAYS stay at top of the main gui where user cant click the main gui to bring it to front again? WinSetOnTop doesnt seem to stay at top. Any ideas?
soulhealer Posted July 20, 2006 Author Posted July 20, 2006 hm, interesting, i'd gladly to know that too, and also, i wanna know how to make the sub gui window is close-able(thru the X button-the top-right edge of the window one) without closing the entire gui window. i mean, i want $GUI_EVENT_CLOSE to be specified only to certain sub gui windows.
jvanegmond Posted July 20, 2006 Posted July 20, 2006 I have recently also posted that. #include <GuiConstants.au3> $G1 = GUICreate("MyGUI", 235, 76, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Button_1 = GUICtrlCreateButton("Continue", 10, 20, 100, 30) $Button_2 = GUICtrlCreateButton("Cancel", 130, 20, 100, 30) GUISetState() $G2 = GUICreate("MyGUI", 168, 81, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Button_1A = GUICtrlCreateButton("Close Gui2 Only", 10, 20, 140, 40) GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg() Select Case $msg = $Button_2 Or $msg = $GUI_EVENT_CLOSE $Hwnd = WinGetHandle('') If $Hwnd = $G1 Then ;maingui - exit Exit ElseIf $Hwnd = $G2 Then GUIDelete($G2) EndIf Case $msg = $Button_1 GUISetState(@SW_SHOW, $G2) Case $msg = $Button_1A GUISetState(@SW_HIDE, $G2) Case Else ;;; EndSelect WEnd Exit github.com/jvanegmond
soulhealer Posted July 21, 2006 Author Posted July 21, 2006 Anyone?i found a way, it's not 'disallow' the user click the main gui, but i hide the main gui instead, using @SW_HIDE, when the sub gui is opened.
Blackstar Posted July 21, 2006 Posted July 21, 2006 Well, i dont want to 'hide' it. I just need it for About box...showing the About box gui and same time hiding the main gui seems so unprofessional...
soulhealer Posted July 21, 2006 Author Posted July 21, 2006 (edited) Well, i dont want to 'hide' it. I just need it for About box...showing the About box gui and same time hiding the main gui seems so unprofessional...i found it ^^use @SW_DISABLE and @SW_ENABLE, to disable or enable the window Edited July 21, 2006 by soulhealer
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