a zorder issue
Consider 4 forms cascaded and overlapping from the top-left corner toward the
bottom-right corner of the screen. Each form has a button on the task bar,
and the buttons are in left to right order with the 4 windows. For naming
purposes, call the forms 1 thru 4 from top-left to bottom-right, and their
task bar buttons are 1 thru 4 from left to right. You randomly and
repeatedly change focus from one window to another by clicking on a form
and/or a taskbar button. If you now activate forms 1 thru 4 in sequence, you
would expect the resulting zorder to be 1 at the bottom, then 2, then 3, and
4 at the top. This appears to be true in all cases but one:
If the app starts 4 forms (sdi ownerless parentless - the simplest way to
start a form), and you left click taskbar buttons 1 thru 4 in order, then
form 4 will be on top, but the zorder of forms 1 thru 3 will be unpredictable.
If the windows are associated with different apps, no problem. If you click
on the title bar of forms 1 thru 4, no problem. If you right click (!) the
task bar buttons 1 thru 4, no problem. Only if you left click on the task
bar buttons do you get unpredictable zorder.
So, what's up? (Its a joke, get it?) Seriously, why this behavior? It
must have something to do with window deactivation processing when there are
multiple restored windows in the same app. This may be a windows question
rather than a .net question, but I encountered while testing a .net app, so I
posted here.
To see this behavior, make .net windows app with a control-less form1. In
Main, do this:
Call (New Form1).Show()
Call (New Form1).Show()
Call (New Form1).Show()
Call (New Form1).Show()
Application.Run
Cascade the windows and make sure the taskbar buttons and the forms are left
to right associated (leftmost taskbar button activates leftmost window).
Now randomly activate for a while by clicking task bar and/or form title bar,
then activate 1 thru 4 by left clicking taskbar buttons 1 thru 4 in order.
Date:Tue, 21 Aug 2007 16:44:04 -0700
Author:
|