Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi VCL Form in Firemonkey Form einbetten (https://www.delphipraxis.net/203897-vcl-form-firemonkey-form-einbetten.html)

Andreas L. 4. Apr 2020 12:18

VCL Form in Firemonkey Form einbetten
 
Liste der Anhänge anzeigen (Anzahl: 2)
Hallo,
ich versuche gerade ein VCL-Form in ein FMX Form einzubetten. Dazu setze ich als Parent des VCL-Forms das FMX-Form. Das geht auch. Nun möchte ich aber das Form in einem weiteren FMX-Form auf einem Panel einbetten. Die FMX-Controls werden auch angezeigt. Nur das VCL-Form nicht. Anbei ist ein Demo-Projekt. Was mache ich falsch?

Anhang 52305

Delphi-Quellcode:
procedure TfrmMain.btnEmbeddFormClick(Sender: TObject);
var
  ContainerForm: TfrmContainer;
begin
  ContainerForm := TfrmContainer.Create(Self);
  ContainerForm.LoadContent;
  ContainerForm.Show;
  Self.EmbeddForm(pnlContainer, ContainerForm);
end;

procedure TfrmMain.EmbeddForm(AParent: TControl;
  AForm: TCustomForm);
begin
  while AForm.ChildrenCount > 0 do
    AForm.Children[0].Parent := AParent;
end;

...

procedure TfrmContainer.LoadContent;
var
  FormHandle: HWND;
  ContentForm: TfrmContainerContent;
begin
  ContentForm := TfrmContainerContent.Create(Self);
  ContentForm.Show;

  FormHandle := FmxHandleToHWND(Self.Handle);
  WinApi.Windows.SetParent(ContentForm.Handle, FormHandle);
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:20 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz