Sign in to follow this  
Followers 0
Info

Child GUI problem...

5 posts in this topic

My child GUI:

$LogGUI = GUICreate("View Log", 224, 114, 400, 300, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
GUISetBkColor (0x000000)
$LogEdit = GUICtrlCreateEdit("", 0, 0, 153, 113, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetBkColor ($LogEdit, 0xFFFFFF);Enter background color here

That's my While:

While 1; MAIN GUI
    $msg = GUIGetMsg(); MAIN GUI
    Select; MAIN GUI
        Case $msg = $GUI_EVENT_CLOSE; MAIN GUI
            Exit; MAIN GUI
        Case $msg = $LogButton; CHILD GUI
            GUISetState(@SW_SHOW, $LogGUI); CHILD GUI

The problem is that when I press on the 'X' in my child GUI, it exits from the main GUI too...

I want it to exit only from the child GUI...

I tried:

Case $msg = $LogButton
            GUISetState(@SW_SHOW, $LogGUI)
            Case $msg = $GUI_EVENT_CLOSE
            GUISetState(@SW_HIDE, $LogGUI)

And:

Case $msg = $LogButton
            GUISetState(@SW_SHOW, $LogGUI)
            Case $msg = $GUI_EVENT_CLOSE
            GUISetState(@SW_DISABLE, $LogGUI)

And:

Case $msg = $LogButton
            GUISetState(@SW_SHOW, $LogGUI)
            Case $msg = $GUI_EVENT_CLOSE
            GUIDelete($LogGUI)

And nothing worked...

Help me please :)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hallo Info

A small main and a child gui example would be something like this

#include <GUIConstants.au3>

$MainWin = GUICreate('MainWindow', 420, 350, -1, -1)
GUISetState(@SW_SHOW,$MainWin)
$ChildWin = GUICreate('Childwindow', 220, 250, 10, 10,-1, $WS_EX_MDICHILD,$MainWin)
GUISetState(@SW_SHOW,$ChildWin)
While 1
$msg = GUIGetMsg(1)
Select
  Case $msg[1] = $MainWin
   If $msg[0] = -3 Then ExitLoop
  Case $msg[1] = $ChildWin
   If $msg[0] = -3 Then GUIDelete($ChildWin)
EndSelect
WEnd
exit

kjactive :)

Edited by kjactive

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I have more buttons in my main GUI... I tried to replace their $msg in $msg[1] and it's not working...

Edited by Info

Share this post


Link to post
Share on other sites

UP

I'll shut up for the next year I swear T_T

Share this post


Link to post
Share on other sites

Hi! You neede this?:

#include <GuiConstants.au3>

$MainGui = GuiCreate("Main GUI", 400, 300)
$LogButton = GUICtrlCreateButton("Switch", 10, 270, 60, 25)

$ChildGui = GUICreate("Child GUI", 300, 200, -1, -1, -1, -1, $MainGui)

GUISetState(@SW_SHOW, $MainGui)

While 1
    $msg = GUIGetMsg(1)
    
    Select
    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $MainGui
        ExitLoop
    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $ChildGui
        GUISetState(@SW_ENABLE, $MainGui)
        GUISetState(@SW_HIDE, $ChildGui)
    Case $msg[0] = $LogButton
        GUISetState(@SW_DISABLE, $MainGui)
        GUISetState(@SW_SHOW, $ChildGui)
    EndSelect
WEnd

Share this post


Link to post
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
Sign in to follow this  
Followers 0