Centering a child form in an MDI Window 
Author Message
 Centering a child form in an MDI Window

I am having a problem that I have not seen before and I am hoping that
someone else can tell me what stupid thing I am forgetting.

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.

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



Wed, 23 Jul 1997 04:49:07 GMT  
 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




Sun, 27 Jul 1997 21:02:19 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Centering child form in mdi window

2. Center an MDI Child in MDI form

3. Q: Form activate Fires On Non Child MDI Forms But Only Once On Child Mdi Forms

4. MDI Child Form Centering

5. Centering MDI Child Form

6. center a child form in a MDI

7. Centering child form in MDI

8. Q: Centering an MDI Child Form

9. Center MDI Child Form

10. How to center the MDI Child form when it is loaded

11. Newbie Question - Center MDI child form

12. How to center MDI child form

 

 
Powered by phpBB® Forum Software