Sign in to follow this  
Followers 0
sandin

Why is my Child window behind it's parrent's controls?

3 posts in this topic

Hi all,

This is the script I'm having issue with:

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
HotKeySet("{ESC}", "exit_script")

$FormMain = GUICreate("Test", 200, 300)
$button1 = GUICtrlCreateButton("WinPopUp", 5, 5, 190, 20)
$tab1 = GUICtrlCreateTab(5, 50, 190, 240)
$tab_item1 = GUICtrlCreateTabItem("Tab1")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
$Form2 = GUICreate("Child", 190, 250, 5, 25, $WS_CHILD, -1,  $FormMain)
$label1 = GUICtrlCreateLabel("Test Label1", 5, 5, 90)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUISetBkColor ( 0xFF0000)
GUISetState(@SW_HIDE)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        case $button1
            GUISetState(@SW_SHOW, $Form2)
    EndSwitch
WEnd

func exit_script()
    Exit
EndFunc

when I click on the button, a window appear, but the window is behind the TAB control? Can this be fixed, so that child window runs in front of the TAB control?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
HotKeySet("{ESC}", "exit_script")

$FormMain = GUICreate("Test", 200, 300)
$button1 = GUICtrlCreateButton("WinPopUp", 5, 5, 190, 20)
$tab1 = GUICtrlCreateTab(5, 50, 190, 240)
$tab_item1 = GUICtrlCreateTabItem("Tab1")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
$Form2 = GUICreate("Child", 190, 270, 2, 25, $WS_CHILD, -1,  $FormMain)
$label1 = GUICtrlCreateLabel("Test Label1", 5, 5, 90)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUISetBkColor ( 0xFF0000)
GUISetState(@SW_HIDE)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        case $button1
            
            GUICtrlSetState($tab1, $GUI_HIDE)
            GUISetState(@SW_SHOW, $Form2)
    EndSwitch
WEnd

func exit_script()
    Exit
EndFunc

GL

Edited by Szhlopp

Share this post


Link to post
Share on other sites

thank you for your help :P

I will use your idea, unless there is a way to display both, tab control and child window, but child window to be on top of the tab control, is there a way to do so?

(This is just a recreation of my original script, in my original script, I have lots, and lots of controls, it would be a drag to make them all hide in order to display child window and show when I close child window, and child window wouldn't go all the way to the bottom of the parent window, so it would be nice if part of the controls would still be visible)

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