Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MDI child minimized/maximized problem

Posted on 2004-09-11
7
Medium Priority
?
2,232 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

618 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