Jump to content

sub gui window, need clarification


Recommended Posts

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

;;;

EndSelect

WEnd

Exit

Func 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

;;;

EndSelect

WEnd

EndFunc

thank's for any help. :">

sorry if the english isn't so good.

Edited by soulhealer
Link to comment
Share on other sites

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)

NEWHeader1.png

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 by soulhealer
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...