[wxPython] Positioning child windows in a wxMDIParentFrame

RE: [wxPython] Positioning child windows in a wxMDIParentFrame
I suspect that for your child windows you’ll want to use GetSize(), which gets the size of the entire window, as opposed GetClientSize(), which won’t include the title bar at the top or the border. You will want to use GetClientSize() for the wxMDIParentFrame, however.

That’s my knee-jerk response. I haven’t actually looked at your source.

Matthew

···

-----Original Message-----

From: Gerson.Kurz@t-online.de [mailto:Gerson.Kurz@t-online.de]

Sent: Thursday, May 09, 2002 1:08 AM

To: wxpython-users@lists.wxwindows.org

Subject: [wxPython] Positioning child windows in a wxMDIParentFrame

I have a wxMDIParentFrame, with some child windows in it, which I want to

arrange so that they completely fill out the MDI space. So, my first guess

was to pass the GetClientSize() result as the size for the child -> however,

this makes the MDIParent create resize scrollbars. If I decrease the

GetClientSize() by, say, 10 each, the Child does fit, but doesn’t exhaust

the child area.

If all that sounds confused, you can try to download

http://p-nand-q.com/python/mdipos.zip. (1080 bytes). It contains two very

small wxPython scripts (30 lines of code each), one with a too-large-child,

one with a too-small-child, differing in one commented-out line only.

Matthew Thornley wrote:

I suspect that for your child windows you'll want to
use GetSize(), which gets the size of the entire window,
as opposed GetClientSize(), which won't include the title
bar at the top or the border. You will want to use
GetClientSize() for the wxMDIParentFrame, however.

I have probably expressed the problem badly. You see, I want to position
child windows so that they exhaust the MDIParentFrame client area.
(Actually, I want to position two MDI childs side-by-side, quite like
MDITile, but manually, so that the positioning can be controlled. With
MDITile, you do not have a say in which window is left, which is right.).

So, I query the GetClientSize() of the MDIParentFrame, and try to use this
when positioning the child windows -> this doesn't work (see sample code).

Gerson Kurz wrote:

I have probably expressed the problem badly. You see, I want to position
child windows so that they exhaust the MDIParentFrame client area.
(Actually, I want to position two MDI childs side-by-side, quite like
MDITile, but manually, so that the positioning can be controlled. With
MDITile, you do not have a say in which window is left, which is right.).

So, I query the GetClientSize() of the MDIParentFrame, and try to use this
when positioning the child windows -> this doesn't work (see sample code).

Hm, one idea that might or might not work, or might cause unacceptable
flicker/delay... you might try using MDITile, and then after the children
have tiled themselves, check whether they're in the right order. If they're
not, then swap them, using the results of their GetSize() methods to determine
where they should be. This way, you let MDITile determine the coordinates,
and then *you* force the correct positioning.

Btw, I'm surprised that MDITile wouldn't let you control which window goes in
which position. I haven't tried MDI under wxPython, but all the MDI apps that
I've used (on Windows at least) have placed the child with focus on the left,
and the child without focus on the right. Perhaps you could record which
child has focus, set focus to the child you want on the left, do MDITile, and
then return focus to the original child?

Jeff Shannon
Technician/Programmer
Credit International