Main form title (sometimes) incorrect on exit/close MDI child form
Posted on 2006-04-12
An application uses MDI in a panel replacement mode (the MDI child occupies the space where the Panel was) and the Main form caption is generated dynamically (as there are many modes that the program could run as)
On selecting an MDI child form (such as Item Maintenance) the main form title changes to a concatenated caption - the original main form caption followed by the MDI child form caption in square brackets. This is as expected.
On exit of the maintenance IN ALMOST ALL CASES the MDI child form although closed, still passes the form caption to the main form so although you have exited back to the main form the last entered MDI form caption is on the main form. This could be a feature but is not wanted.
Have tried resetting the main form caption after closing all MDI children, but even when this is done and DEBUGged the caption is the same after as before. It suggests that the main form caption is overridden, but with what?
Example 'home1click(Sender)' called on exit from any MDI child process.
procedure TForm1.Home1Click(Sender: TObject);
for i := MDIChildCount-1 downto 0 do // close open windows, who ever they are...
if loggedin=true then ButtonMenuOn;
panel1.visible:=true; // MDI Panel
<< at this point caption might be 'Document Tracking System - [Item Maintenance] >>
form1.Caption:=UpCaseFirst(runt)+' Tracking System';
<< At this point caption is still 'Document Tracking System - [Item Maintenance] >>
As mentioned, not all MDI child exits do the same. All the forms have the same variable parameters, but on exit of the Population enquiry' panel using the same method as all the others the MDI Child title correctly disappears.