?
Solved

MDI child minimized/maximized problem

Posted on 2004-09-11
7
Medium Priority
?
2,196 Views
Last Modified: 2008-01-16
I have an MDI app in which I want to open the first MDI child window in a maximized state.
I also want to set the width and height of the child window (when it is first loaded) so that if/when the user "restores" the MDI child (i.e. un-maximizes it) then it will resize to the width and height previously set.

My code currently does this:
1. Create the MDI child form.
2. In the Form Show event, load the required WindowState (wsMaximized or wsNormal) state from a config file and set the MDI child window's WindowState accordingly.
3. In the Form Show event, load the required width and height from a config file and set the MDI child's width and height accordingly.

Now the Problem...

When I set the width of the maximized MDI child window, it becomes un-maximized.
So, how can I set the width without un-maximizing the MDI child window?

Ideally, I want to be able to create the *first* MDI child window in a maximized state, *and* set it's width and height (and left and top) so that when a user unmaximizes the MDI child window it is positioned and resized to the appropriate position and size.

Thanks
Paul
0
Comment
Question by:zebada
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 10

Expert Comment

by:Jacco
ID: 12033981
If I am correct it is like this: When the use restores from maximized the form will get the width/height in which it is designed in the IDE.

Regards Jacco
0
 
LVL 10

Assisted Solution

by:Jacco
Jacco earned 501 total points
ID: 12033993
Sorry, I wrong things are actually a bit more complicated...
0
 

Accepted Solution

by:
a_minde earned 501 total points
ID: 12034011
I have done this and it works fine.
1. In the IDE, make sure the form's Windowstate is wsNormal
2. In the form's OnShow event, first set the width and height as loaded from your configs.
3. Then, In the form's OnShow event, set the windowstate to the wsMaximized
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Author Comment

by:zebada
ID: 12036753
Hi Jacco,

That is exactly what I am doing - the problem with that is this:
If I open up a second copy of the child window then it shows up as maximized (because the current child state is maximized).
Then I set the width and height in the onshow event and all the child windows become "normal"
Then I set the state to maximized and all the child windows go back to maximzed.
The Maximized->Normal->Maximized cycle of the display is disconcerting and looks really *bad*.

What I am trying to find out is how to set the width and height *without* also setting the windowstate to normal as a side effect.

Regards
Paul
0
 
LVL 17

Assisted Solution

by:geobul
geobul earned 498 total points
ID: 12053159
Hi,

Move the code in MDIChild's OnCreate event instead and in the following order:

1. Read and set width and height properties
2. Read and set WindowState property

Now, all the parameters have already been set when the form is being shown.

Regards, Geo
0
 
LVL 6

Author Comment

by:zebada
ID: 13342209
I ended up going with a different solution. I used
LockWindowUpdate(Handle);
and
LockWindowUpdate(0);
Around the MDI child form creation code which solved the problem.

Split the points between the three replies - at least you guys bothered to answer me :)
Thanks
Paul


0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question