Reputation: 101
This is my first topic
In the same application:
I Have a NormalForm (Mainform), that in a Popupmenu call's MDIForm like this:
MDIForm:=TMDIForm.Create(nil);
MDIForm.Show;
The forms open correctly... Now, in the MDI form i try to create MDIChild with:
fm := TMDIChild.Create(Self);
fm.FormStyle:=fsMDIChild;
fm.Show;
Retrieve the error: Cannot Create Form. No MDI Forms are currently active
Anyone knows how do that?!
Upvotes: 1
Views: 6129
Reputation: 595349
The VCL does not natively support what you are attempting. It requires the app's MainForm
to be set to FormStyle=fsMDIForm
, and it only looks at the MainForm. Your MainForm is not set up that way.
This is a VCL limitation, not a Windows limitation. It is possible to work around this and use MDI child forms in other non-MainForm forms, but it requires quite a bit of hacking of the VCL's source code. See this example and this QC report.
Upvotes: 1
Reputation: 1284
You can't mix form styles like that. An MDI child form expects the main form of the application to be an MDI form. The VCL's code does not look to see if any MDI forms are available when the child is created.
Upvotes: 4