Changing the ActiveMDIChild
Posted on 1998-07-28
I have a problem that I hope that some of you can help me with.
How do I set the active MDI child of a form ???
I have a form (Form1) with FormStyle=fsMDIForm and two other forms (Form2 and Form3) both with FormStyle=fsMDIChild - they are MDIChilds of Form1. I want to be able to change the ActiveMDIChild of Form1 to say Form2 - how do I do that. If there is no controls on Form2 it is easy done with Form2.SetFocus, but if there is some controls on Form2 Form2.SetFocus just called SetFocus of the ActiveControl of Form2 and Form2 will not nessacary become the ActiveMDIChild of Form1.
There must be a way to change the ActiveMDIChild of Form1, even though the form that you want to become the ActiveMDIChild has some controls on itself. Right now I cheat to do it ...
AWC : TWinControl;
AWC := Form2.ActiveControl;
Form2.ActiveControl := nil;
Form2.ActiveControl := AWC;
... but cant anyone tell me a better way to do it ???