I'm looking to prevent MDI child WindowState changes occurring when creating a second MDI child...
I have an application that I'm developing, written in Delphi. Through a little Delphi/Windows magic, the application has multiple MDI Parents and multiple MDI Children.
I can create a form (Child A1), and maximize it within an MDI parent (Parent A). I can create a second form (Child B1) and maximize it within a second MDI parent (Parent B). Both forms will be mazimized in seperate MDI parents. So far so good. I've got this working.
However, when I create a second MDI child (Child A2) in the first MDI parent (Parent A) the WindowState (wsMaximized) of the first child (Child A1) changes when the second child (Child A2) is created. I want the first child (Child A1) to remain maximized, and the second child (Child A2) to be created and placed on top of the first child...
How can I prevent the state of the first MDI Child changing but also create a second MDI child? Any hints?
OK - Now I've had some lunch maybe I can explain it better... here's a second go at it...
The behaviour described can be reproduced in a simple MDI application (the magic I have used to create multiple MDI parents doesn't impact my problem)
Create a new forms application changing formstyle to fsMdiForm Create a second form change its style to fsMDIChild Create a third form change its style to fsMDIChild
Run the app. Instantiate the second form, then maximize (works as expected - maximizes in MDI Parent) Instantiate the third form, the third form opens with window state wsNormal. But when the third form is created, the window state of the second form changes - it ceases to be maximized, and becomes wsNormal, as if you had clicked restore!
I want to avoid the restoring of the second form when I open the third form... (All forms have an initial WindowState of wsNormal...
Any hints greatly appreciated!
Remy and David are both correct in that it's an MDI limitation.
My solution in end, which does work, has been to maintain a ChildWindowState (which is just a WindowState) on each child form, then handling resizing/positioning of child windows when ChildWindowState changes... It's not a pretty answer but it does provide the functionality I needed in my application.
Thanks for all the answers :)