
Centering a child form in an MDI Window
(...stuff deleted ...)
Quote:
>I have an MDI form that is maximized at startup. The load procedure for
>this form Shows a child form. The child form has a load routine that
>centers the form on the screen object by using the
>left=(screen.width-width)/2 and top=(screen.height-height)/2. The
>scalemode for the child is twips. The problem is that when I run the
>program the child form shows up centered, but it is about half as high as
>it should be. It appears that the app is remembering the form size as the
>size it was when it was created. I then changed it and adjusted its size.
>Using scalemode=pixels doesn't help. When I hard code the form width and
>height into my load routine the problem goes away, but it is shifted
>downwards a little bit (0.5"). The thing is, I am not setting the iwdth or
>height of the form in any other code module or subroutine.
Wrong location. Put the code in the Resize routine of your MDI parent form.
It works - but don't ask me why. Stupid thing is that the top value is
halved if you put the code in the Load routine - I experienced that too.
It seems like the top property of the child form is set, THEN the MDI
parent is maximized, and THEN the left property of the child form is set.
Hardly possible of course, but the effect is alike.
Richard.
=====================================================================
=-OOOO---O--------O-------------------O---==- R.G.J. Odekerken -----=
=-O---O-----------O-------------------O---==- Flakkeesestraat 27-b -=
=-OOOO---O---OOO--OOO----OOO--OOO---OOO---==- 3083 CA Rotterdam ---=
=-O---O--O--O-----O--O--O--O--O----O--O---==- The Netherlands ------=
=-O---O--O---OOO--O--O---OOO--O-----OOO---==- 31-(0)10-4807983 -----=
=====================================================================
=-- WWW HomePage: http://www.twi.tudelft.nl/~odekerk/richard.html --=
=====================================================================
Quote:
>This one is a little weird to me. I have written several applications and
>have never seen this happen before. Can anyone suggest what might be going
>on?
>Thanks in advance for your help!
>Sam Israelit