Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In my application, I also use multiple MDI Parents. Below is my magic code, where the different Childs have different states, in each Parent.</p> <p>This code is adopted from: <a href="http://cc.embarcadero.com/item/23574" rel="nofollow">ID: 23574, Multiple MDI Parent Forms in a single Application</a></p> <pre><code>//Add multiple MDIForm support TFormMDIEnhance = class(TForm) private _mdiClientHandle: HWND; function GetMDIClientHandle: HWND; protected procedure CreateWindowHandle(const Params: TCreateParams); override; procedure DestroyWindowHandle; override; end; procedure TFormMDIEnhance.CreateWindowHandle(const Params: TCreateParams); var mdiStruct: MDICREATESTRUCT; begin _mdiClientHandle := GetMDIClientHandle; if (FormStyle = fsMDIChild) then begin mdiStruct.szClass := Params.WinClassName; mdiStruct.szTitle := Params.Caption; mdiStruct.hOwner := HInstance; mdiStruct.x := Params.X; mdiStruct.y := Params.Y; mdiStruct.cx := Params.Width; mdiStruct.cy := Params.Height; mdiStruct.style := Params.Style; mdiStruct.lParam := LPARAM(Params.Param); WindowHandle := SendStructMessage(_mdiClientHandle, WM_MDICREATE, 0, mdiStruct); Include(FFormState, fsCreatedMDIChild); end else inherited CreateWindowHandle(Params); end; procedure TFormMDIEnhance.DestroyWindowHandle; begin if fsCreatedMDIChild in FFormState then SendMessage(_mdiClientHandle, WM_MDIDESTROY, Handle, 0) else inherited DestroyWindowHandle; _mdiClientHandle := 0; end; function TFormMDIEnhance.GetMDIClientHandle: HWND; var fm: TForm; begin result := 0; if Owner is TForm then begin fm := Owner as TForm; if Assigned(fm) then Result := fm.ClientHandle; end; if (Result = 0) and Assigned(Application.MainForm) then Result := Application.MainForm.ClientHandle; if Result = 0 then raise EInvalidOperation.Create(SNoMDIForm); end; </code></pre> <p>Inherit your forms from that Base form, then you can create multiple MDI Parents. Maybe that helps.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload