Problems with owner/owned windows.
Iâm attempting to use the concept of window ownership and Iâm having a few
problems.
To my understanding, a top-level window can specify another top-level window
as its owner. The owned window will then always be in front of the owner
window in the z-order, and the owned window will be hidden/shown when the
owner window is minimized/maximized.
This is the behavior that I desire and it works well.
The problems Iâm having are the following:
1.) If the owner window happens to be minimized at the moment that the owned
window is first created and the ownership is established, then the UI ends up
in a strange state. The owned window appears as initially visible even though
the owner is minimized. Furthermore, clicking on the owner windowâs button on
the task bar will not restore the owner window; it will only flash the owned
window. The owner window only becomes accessible again after I close the
owned window.
2.) Whenever the owned window is closed, the owner window jumps to the back
of the z-order behind all other top-level windows on the desktop.
For problem #1, Iâve tried using a little workaround where I always make
sure that the owner window is fully restored and visible prior to creating
the owned window. This seems to work, but Iâd like to not have to do this.
For problem #2, Iâve been able to get around this by breaking the ownership
link in the owned windowâs OnClose() handler just prior to closing. Once
again, this seems kind of dirty and Iâd rather not do it.
Does anyone have any thoughts on this? It seems like window ownership is not
used very frequently and Iâve been unable to find too much information about
it online. Any help is appreciated.
Thanks.
date: Mon, 7 Jul 2008 10:50:07 -0700
author: Doug E. Codemonger