Sign in to follow this  
Followers 0
CFire

Problem: Parent Moves under Child

7 posts in this topic

I have an issue with the parent-child styling where the child has almost a 'topmost' style to it by default and when the parent moves over it, it actually moves under it. I was wondering if there is a way to fix this to make the Parent the more dominant window. This is the way i am setting up the parent and child gui's.

$Parent = GUICreate("Parent",200, 200)
GUISetState (@SW_SHOW)

$Child = GUICreate("Child", 200, 200, 100, 100, -1, -1, $Parent)
GUISetState (@SW_SHOW)

[u]Scripts and UDF's[/u]WMMedia - UDF full of functions to Control Media Output.

Share this post


Link to post
Share on other sites



Yeah this is a good question. I'm having the same problem???

Share this post


Link to post
Share on other sites

I tried something but i'm not quite sure i did it right. do u have an example code that uses this function?


[u]Scripts and UDF's[/u]WMMedia - UDF full of functions to Control Media Output.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Maybe this is what youre looking for.

The code is using the extended options of the getmsg function.

It give control to the child window and disables the parent

I used $WS_SYSMENU,$WS_EX_TOOLWINDOW to disable all system window functions

If you want those enabled you must add the proper handling of it in the code

#include <GUIConstants.au3>

$gui=GUICreate("Parent", 300, 300)
$button=GUICtrlCreateButton("test",10,10,100,15)
GUISetState(@SW_SHOW)

do
  $msg = GUIGetMsg()
  Select
  Case $msg = $button
     WinSetState($gui,"",@SW_DISABLE)
     $guichild=GUICreate("Child",200,200,-1,-1,$WS_SYSMENU,$WS_EX_TOOLWINDOW)
     GUISetState(@SW_SHOW,$guichild)
     do
       $childmsg = GUIGetMsg(1)
       if not WinActive($guichild) and Winactive($gui) Then winactivate($guichild)
     until $childmsg[0] = $GUI_EVENT_CLOSE and $childmsg[1] = $guichild 
     WinSetState($gui,"",@SW_ENABLE)
     GUIDelete($guichild)
  EndSelect
until $msg = $GUI_EVENT_CLOSE
Edited by socratessa

Dont cry tomorrow about what you should have done yesterday. Just do it now.

Share this post


Link to post
Share on other sites

That script deactivates the parent while being able to work on the child. I was looking for something that makes both the parent and child able to be used but when you drag the parent window over the child it actually goes over it not under it.

This Script is an example of what im talking about where the child gui is always above the parent gui. I dont know how to fix it.

#include <GUIConstants.au3>
Dim $msg

$Parent=GUICreate("Parent", 200, 100)
GUISetState(@SW_SHOW)
$Child = GUICreate("Child", 200, 100, -1, @DesktopHeight/2, 0, 0, $Parent)
GUISetState(@SW_SHOW)

While $msg <> $GUI_EVENT_CLOSE
  $msg = GUIGetMsg()
WEnd

[u]Scripts and UDF's[/u]WMMedia - UDF full of functions to Control Media Output.

Share this post


Link to post
Share on other sites

As far as I know that's just how parent/child windows work. Is there any particular reason you need to have the windows setup this way? Could you not just use two unrelated windows?

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