[Design] dialog.CenterOnSCreen() ?

Robin Dunn robin at alldunn.com
Wed Feb 7 13:23:36 PST 2007


Heikki Toivonen wrote:

> But I also realized CenterOnParent() would not help in your scenario,
> because the dialogs would just stack on top of each other, albeit all
> centered on Chandler. Dialogs should center on Chandler, except when
> there already is such a window their placement should cascade. I wonder
> if Center() method does that, or would they cascade automatically if you
> didn't call anything?

If you don't call anything and don't specify an actual position, then 
the dialog will be positioned by whatever is the platform default.  On 
Linux that depends on the window manager's placement rules, it could be 
cascading, wherever there is some empty space, or even random.   On 
Windows they will likely be cascaded, depending on where the last 
default/cascaded window was positioned.  On Mac it looks like it is 
defaulting to the upper-left corner of the screen, just below the menu 
bar, so they would end up stacked on each other there.  I'll check and 
see if that is something that wxWidgets is explicitly doing or if that 
is really the default.

BTW, since wx.MessageDialog and some of the other common dialogs are not 
a real dialog but rather just a thin wrapper around the system message 
API, then they will follow their own rules no matter what you specify 
for a position.  For example, on Windows the wx.MessageDialog is always 
centered on screen, but the wx.FileDialog is always centered on its parent.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!



More information about the Design mailing list