Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDI Child WindowState in a Right State!

Status
Not open for further replies.

GlynW

Programmer
Feb 14, 2001
22
0
0
GB
I have a MDI form with lots of child windows which are created from a toolbar on the mdi parent.. no problem..

I want all the MDI children to open maximized, and always stay maximized, and this is becoming a bit of a problem...

If I close one of the children, all the others all revert to a wsNormal state.

I have got round this by forcing all the windows back to wsMaximized, but the children keep zooming in and out, and frankly looks a bit crap.

Does anyone know a better way of stopping the other mdi children from reverting to wsNormal?

Cheers
Glyn
 
Your problem is that you're not really using MDI the way it was intended. MDI is supposed to allow the user to resize windows to taste; if you want everything maximised all the time, perhaps a different solution is in order.

Note also that Microsoft have deprecated MDI. But then, perhaps you don't want to take UI advice from people who say things like "Click Finish to Start...", and "To continue, click Back."

One option to consider would be to use a TTabControl. (Don't confuse this with a TPageControl.) Add one tab for each "window" that's open. When the user clicks on a tab, set the matching "child window"'s Parent property to the TTabControl. This wil embed the child window inside the TTabControl. You can create and destroy forms as usual; it's just that they display a little differently. You might want to take a look at Mozilla's tabbed browsing to see what I'm talking about. -- Doug Burbidge mailto:dougburbidge@yahoo.com
 
Thanks for the advise, but i don't agree...
The users can resize the windows if they want to, I just want all the windows to default to maximized, and stay maximized unless the |-|_|x| buttons have been pressed.

There are a lot of Applications that work this way.. Sage Line50 Accounts (one that springs to mind). and that is written in C, and allows the interface which I described.

I've written similar applications in Visual Basic using MDI which allow the users to resize the windows if they want to, but default to maximized, but am having a problem in Delphi, and was hoping someone had created something similar.

Thanks

Glyn
 
WORKED IT OUT!
==============

I've posted this for anyone else who has the problem I described above and does a search in TekTips..

The problem was solved by making sure that all MDI Children are set to WindowState wsNormal, and then Maximize in code when creating the instance, this way they all stay maximized untill somebody wants to change them.

Having any of the children with a default state of Maximized will cause all children to default to normal when a maximized child in closed, and a child with maximized as default gains the focus...

bit of a mouthfull, but thats what caused my problem and how I got round it...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top