Sign in to follow this  
Followers 0
monoceres

MDI Child in parent client rect

8 posts in this topic

I'm trying to have a MDI child overlay the parent's client area. The documentation says that when specifying $WS_EX_MDICHILD the position is relative to the client rect of the parent window, this however doesn't seem to be true since when specifying 0,0 the child appears outside the parent windows client area.

Sample code that demonstrate the problem below.

#include <GuiConstantsEx.au3>
#include <windowsconstants.au3>

$MainhWnd = GUICreate("Welcome", 400, 300)
GUISetBkColor(0)
GUISetState()

$childhwnd = GUICreate("", 400, 300, 0, 0, $WS_POPUP+$WS_CHILD, $WS_EX_TOPMOST + $WS_EX_MDICHILD, $MainhWnd)
GUISetBkColor(0xFF0000)
GUISetState()
WinSetTrans($childhwnd, "", 128)


Do
Until GUIGetMsg()=-3

As you might guess the goal is to have the semi transparent red color covering the entire client rect of the parent window.

Anyone know how to fix? :D


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm trying to have a MDI child overlay the parent's client area. The documentation says that when specifying $WS_EX_MDICHILD the position is relative to the client rect of the parent window, this however doesn't seem to be true since when specifying 0,0 the child appears outside the parent windows client area.

Sample code that demonstrate the problem below.

#include <GuiConstantsEx.au3>
  #include <windowsconstants.au3>
  
  $MainhWnd = GUICreate("Welcome", 400, 300)
  GUISetBkColor(0)
  GUISetState()
  
  $childhwnd = GUICreate("", 400, 300, 0, 0, $WS_POPUP+$WS_CHILD, $WS_EX_TOPMOST + $WS_EX_MDICHILD, $MainhWnd)
  GUISetBkColor(0xFF0000)
  GUISetState()
  WinSetTrans($childhwnd, "", 128)
  
  
  Do
  Until GUIGetMsg()=-3

As you might guess the goal is to have the semi transparent red color covering the entire client rect of the parent window.

Anyone know how to fix? :D

Not sure if a workaround is what you want because I think you would already have considered this, but just in case-

#include <GuiConstantsEx.au3>
 #include <windowsconstants.au3>
 
 $MainhWnd = GUICreate("Welcome", 400, 300)
 GUISetBkColor(0)
 GUICtrlCreateButton("kjk",50,100,100,22)
 GUISetState()
 $iHeight = DllCall('user32.dll', 'int', 'GetSystemMetrics', 'int', 4);$SM_CYCAPTION)
 $childhwnd = GUICreate("", 400, 300, 0, $iHeight[0],BitOr($WS_POPUP, $WS_CHILD), BitOr($WS_EX_TOPMOST, $WS_EX_MDICHILD), $MainhWnd);
 GUISetBkColor(0xFF0000)
 GUISetState()
 WinSetTrans($childhwnd, "", 128)
 
 Do
 Until GUIGetMsg()=-3

I see the note in the on-line help about a midichild being created relative to the client area of the parent, but I don't see it in the help suplied with AutoIt download.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Which on-line help Martin?


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Which on-line help Martin?

This one.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Outdated

Try This one. It's kept current to the release version, not Beta. I removed the Beta versions a long time ago and I can't decide if I should put them back up or not.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Thanks martin for the suggestion, it indeed looks nice, however it does feel like an ugly hack to do something that should be done automatically. The problem I had directly when testing this in my application is that my main window changes styles depending on user input, making the offset different. I guess I can hardcode the required calculations for each style, but it seems weird.

The note in the documentation I mentioned is still in the latest version, just check the remarks section of GUICreate().

Anyway, maybe a bug report is in place? In any case the documentation doesn't match the behaviour.


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Thanks martin for the suggestion, it indeed looks nice, however it does feel like an ugly hack to do something that should be done automatically. The problem I had directly when testing this in my application is that my main window changes styles depending on user input, making the offset different. I guess I can hardcode the required calculations for each style, but it seems weird.

The note in the documentation I mentioned is still in the latest version, just check the remarks section of GUICreate().

Anyway, maybe a bug report is in place? In any case the documentation doesn't match the behaviour.

Yes, the documentation is quite clear so I agree that it's a bug and should be reported. I saw it in the in-line help but missed it in the supplied help. The offset obviously takes into account the border or lack of it, width but somewhere the caption height is forgotten or misused.

The other annoying thing about the simulated MIDI child is that the x,y position is only relative to the parent client when you cretae it. If you move it with WinMove the coordinates are screen based and not like a child window.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Yes, the documentation is quite clear so I agree that it's a bug and should be reported. I saw it in the in-line help but missed it in the supplied help. The offset obviously takes into account the border or lack of it, width but somewhere the caption height is forgotten or misused.

The other annoying thing about the simulated MIDI child is that the x,y position is only relative to the parent client when you cretae it. If you move it with WinMove the coordinates are screen based and not like a child window.

Thanks again, I submitted a bug report and mention both problems. Hopefully this can be solved soon :D


Broken link? PM me and I'll send you the file!

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