Jump to content

Still trying to figure out the parent - child stuff*


Recommended Posts

Hi,

Can somebody please define the parent/child window relationship in lame-man terms for me? I've been learning how to create GUIs from the manual, Koda, and examples on the board,..but I'm still not sure about what characteristics a window takes on once you've declared it to be a child/parent or applied one of the related styles.

In a nutshell,..what's up with $WS_CHILD, $WS_POPUPWINDOW, $WS_POPUP, and $WS_EX_MDICHILD? ...and how is setting a style to $WS_CHILD different than defining a parent in GUICreate()?

Thanks,

The Noob.

Link to comment
Share on other sites

This should give you an idea about $WS_CHILD.

#include <GUIConstants.au3>

$parent = GUICreate("$WS_CHILD Example", 300, 300)

$child = GUICreate('', 260, 260, 20, 20, $WS_CHILD, $WS_EX_CLIENTEDGE, $parent)
GUICtrlCreateLabel('This is the child gui.', 10, 10, 200, 20)

GUISetState(@SW_SHOW, $parent)
GUISetState(@SW_SHOW, $child)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Link to comment
Share on other sites

Hi,

Thanks a lot. So the WS_CHILD makes a window that behaves more like a segment of the parent than an independent window? Does that sound about right?

When I switched it to $WS_EX_MDICHILD it was a seperate window, but I was expecting it to move along with the parent. This is what the manual says:

"Create a child window that will be moved with its parent.(simulation of a MDI window maximize/minimize are not simulated)."

Then I realized that ex_mdi is an extended style, but why did it work in the regular style's position? When i tried moving it to the next parameter slot like this: $child = GUICreate('', 260, 260, 20, 20, $WS_CHILD, $WS_EX_CLIENTEDGE + $WS_EX_MDICHILD, $parent),...it didn't seem to create a window at all. Then I tried replacing $WS_CHILD with "" and it created a nice seperate centered window, but that one didn't move with the parent either. When I moved the parent it just kinda sat there and got redrawn funky.

Even though I'm stuck I'm a lot better off than I was before your reply so thanks.

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...