Sign in to follow this  
Followers 0
bsbllnut

GUI Parent Hide

4 posts in this topic

Is there a way to make a parent GUI hide once you have activated a child GUI if they are in the same file? I can get it to operate with seperate files but for simplicity sake would like to keep me script as concise and in one place as possible. I am very new to auto it and I'm coming along so any help would be appreciated

Thank you

Share this post


Link to post
Share on other sites



never mind all I found it. Sorry to take up time

Case $Button1

GUIDelete($Form1)

$Form2 = GUISetState(@SW_SHOW)

This did it !!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Came out of surgery a few days ago (got my appendix out), but i'm going to have a stab at this anyway.

Forgive me if i do something wrong, i can't brain today :P

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$ParentGUI = GUICreate("Parent GUI", 500, 150)
GUISetState()

$ChildGUI = GUICreate("Child GUI", 300, 100, -1, -1, -1, -1, $ParentGUI)
GUICtrlCreateLabel("Activate the Child GUI to hide the Parent GUI, then switch focus to another window to show the Parent GUI", 50, 20, 200, 60)
GUISetState()

WinActivate($ParentGUI)

GUIRegisterMsg($WM_ACTIVATE, 'MY_WM_ACTIVATE');register a GUI message, in this case the WM_ACTIVATE message

While GUIGetMsg() <> $GUI_EVENT_CLOSE
    Sleep(10)
WEnd

Func MY_WM_ACTIVATE($hWnd, $Msg, $wParam, $lParam);You can read more about these parameters in the helpfile under GUIRegisterMsg
    ConsoleWrite($hWnd & @TAB & $ChildGUI & @TAB & $ParentGUI & @LF & $Msg & @TAB & $wParam & @TAB & $lParam & @LF & @LF)
    
    Local $IdFrom = BitAND($wParam, 0xFFFF)
    Local $iCode = BitShift($wParam, 16)
    
    ConsoleWrite($IdFrom & @TAB & $iCode & @LF & "============================" & @LF)
    Switch $hWnd
        Case $ParentGUI
    ;Do nothing
            
        Case $ChildGUI
            If $IdFrom = 2 Then
                GUISetState(@SW_HIDE, $ParentGUI)
            Else
                GUISetState(@SW_SHOW, $ParentGUI)
            EndIf
    EndSwitch
EndFunc ;==>MY_WM_ACTIVATE

*EDIT*

Bleah, after all that :P

Edited by SxyfrG

My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website

Share this post


Link to post
Share on other sites

Wow i like that even better than way I found. I dont have to reactivate the parent when I want to go back

Thank you !!

Came out of surgery a few days ago (got my appendix out), but i'm going to have a stab at this anyway.

Forgive me if i do something wrong, i can't brain today :P

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$ParentGUI = GUICreate("Parent GUI", 500, 150)
GUISetState()

$ChildGUI = GUICreate("Child GUI", 300, 100, -1, -1, -1, -1, $ParentGUI)
GUICtrlCreateLabel("Activate the Child GUI to hide the Parent GUI, then switch focus to another window to show the Parent GUI", 50, 20, 200, 60)
GUISetState()

WinActivate($ParentGUI)

GUIRegisterMsg($WM_ACTIVATE, 'MY_WM_ACTIVATE');register a GUI message, in this case the WM_ACTIVATE message

While GUIGetMsg() <> $GUI_EVENT_CLOSE
    Sleep(10)
WEnd

Func MY_WM_ACTIVATE($hWnd, $Msg, $wParam, $lParam);You can read more about these parameters in the helpfile under GUIRegisterMsg
    ConsoleWrite($hWnd & @TAB & $ChildGUI & @TAB & $ParentGUI & @LF & $Msg & @TAB & $wParam & @TAB & $lParam & @LF & @LF)
    
    Local $IdFrom = BitAND($wParam, 0xFFFF)
    Local $iCode = BitShift($wParam, 16)
    
    ConsoleWrite($IdFrom & @TAB & $iCode & @LF & "============================" & @LF)
    Switch $hWnd
        Case $ParentGUI
;Do nothing
            
        Case $ChildGUI
            If $IdFrom = 2 Then
                GUISetState(@SW_HIDE, $ParentGUI)
            Else
                GUISetState(@SW_SHOW, $ParentGUI)
            EndIf
    EndSwitch
EndFunc;==>MY_WM_ACTIVATE

*EDIT*

Bleah, after all that :P

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