1
votes

Is there a way to show MDI child forms (FormStyle = fsMDIChild) on the main form that has a frame with Align = alClient?
Creating a frame on the main form:

Frame := TfrCalendar.Create(Self);
Frame.Parent := Self;   

Creating MDI child form on the main form:

if Assigned(FMDIRef)
then
  FMDIRef.BringToFront
else begin
  FMDIRef := TFReference.Create(Application);
  FMDIRef.Show;
end;

After this, the child form is not visible. If you do not create a frame, the form is visible. If you first show the child form, and then create a frame on the main form, then the child form becomes invisible again.

1

1 Answers

5
votes

The issue here is that your frame is competing for space with the MDI client window. The MDI client window is the window which is parent to the MDI child windows.

In your scenario the frame consumes all remaining client area inside the main window, thus leaving no space for the MDI client window.

What you are attempting is not possible. The MDI client window has to go somewhere, and you must leave it some room.

Depending on what your actual goal is, different solutions are available:

  • If the frame is intended to be visible always, then use alTop. The remaining space below it will be available to the MDI client window.
  • If you wish to show an image on the MDI client window to act as a background, refer to my answer here: https://stackoverflow.com/a/15137740/505088