14. How to integrate a full FMX-App into your VCL-App
14. Wie Sie eine vollständige FMX-App in Ihre VCL-App integrieren

GERMAN

Wir kennen bereits Möglichkeiten, FMX-Code in einer VCL-Anwendung zu verwenden, z.B. über Einbindung einer FMX-DLL, der Verwendung eines TFireMonkeyContainers oder der Verwendung von Hydra.

Eine weitere Möglichkeit besteht darin, eine vollständige FMX-App zu erstellen und deren Fenster innerhalb des VCL-Programms auszuführen.

English

We know already ways how to use FMX-code in a VCL-application, e.g. by using a FMX-DLL, by use of a  TFireMonkeyContainer or the integration via  Hydra.

But an other way is to build a full FMX-App and run it in a VCL-window.


Dazu starten Sie die FMX-App, ermitteln das Windows-Handle und setzen ein TPanel aus der VCL-App als Parent.

Die nachfolgende Prozedur gibt den Prozess wieder:


You start the FMX-App, grab the window-handle and set a Tpanel from the VCL-App as parent.

The following code will demonstrate this:


 

GERMAN

Wenn die FMX-APP an das VCL-TPanel gebunden wurde und dieses in der Größe geändert wird, muss das Fenster der FMX-App entsprechend angepasst werden:
English

When the FMX-App was bound to the VCL-TPanel and that panel will be resized, then you have adapt the size of the FMX-App-window accordingly.


procedure TF_Organizer.pnAlbumBackResize(Sender: TObject);
begin
  if pnAlbumBack.Tag > 0 then begin
     MoveWindow(pnAlbumBack.Tag, 0, 0, pnAlbumBack.Width, pnAlbumBack.Height, True);
  end;
end;


Und wenn die VCL-Anwendung am beendigt wird, müssen Sie dafür sorgen, dass auch die FMX-APP beendet wird:
 

When you exit the VCL-App you have also to take care that the FMX-App will also be stopped:
// in OnDestroy Main form
if (F_Organizer <> nil) and (F_Organizer.pnAlbumBack.Tag > 0) then begin
  PostMessage(F_Organizer.pnAlbumBack.Tag, WM_CLOSE, 0, 0);
  sleep (100);
end;
Hier sehen Sie einen Screenshot mit der integrierten FMX-App. Der rote Rahmen gibt an, bis wohin das Fenster der FMX-App geht.
 
And here you see a screenshot of the integrated FMX-App. The red frame indicates the dimension of the FMX-window.


 

GERMAN

So haben wir also erneut eine Möglichkeit kennen gelernt, wie man seine VCL-Anwendung sinnvoll mit FMX-Code erweitern kann.

Ich möchte noch anmerken, dass es mit FMX ganz leicht war, den Photo Album Editor zu entwickeln, mehr als 1-2 Tage habe ich nicht gebraucht. Mit VCL wäre es sehr viel schwerer gewesen das hinzubekommen, wenn überhaupt.

Ich habe den Album Editor als Ergänzung für mein VCL- Bildbearbeitungsprogramm (PixPower) entwickelt. Aber wenn man das schon einmal macht, warum nicht diese Ergänzung als selbständiges Programm auch für für MAC oder Linux verwenden?

Daher habe ich auch eine Version für MAC und mit FMXLinux auch eine Version für Linux entwickelt, hier können Sie ein paar Screenshots sehen: http://www.photoalbumeditor.de

 

English

So know you know an additional way to enhance your VCL-App with FMX.

I have to remark, that it was very easy with FMX to build the Photo Album Editor, it takes not more then 1-2 days. With VCL it would have been much more complicated.

I have build the Photo Album Editor as extension for my Image-Editor "PixPower". But having done this, why should I not use the extension also as stand alone program, also for MAC and Linux Platform?

So I have build a MAC-version and with FMXLinux also a Linux-Version. Here you can see some screenshots: http://www.photoalbumeditor.de

Ich habe auch ein kurzes Video (in englischer Sprache) erstellt, welches die technische Seite ein wenig mehr erläutert: In a short video (in english language) you can see more about the technical details:
 
 

Video auf YouTube: https://youtu.be/kqOnZn_sHUI

 

Video on YouTube: https://youtu.be/kqOnZn_sHUI