embeddedform TacEmbeddedForm component
Hierarchy Properties
Return to Introduction  Previous page  Next page
Overview
The acEmbeddedForm component used to insert the form and all its content to any successor of TWinControl (i.e: Panels, GroupBoxes, Labels, pages of PageControl etc).  
 
This is better than usual frames that comes with Delphi/BCB beginning from v5 since:  
1. You can dynamically change the container of the embedded form at run-time (dynamically insert or remove the form from any successor of TWinControl).  
2. Still have all functionality of usual form (some controls can be placed only to form or its successor).  

How to use?
Just select the control which should contain the form in the HolderControl property and specify the name of form to insert in the FormName property. You can change these propertis at run-time to "embed" or "un-embed" the forms from specified controls.  
 
Notes
1. You can specify the source form and target control at design-time but the "embedding" take effect at run-time only!  
 
2. Component do not raise any error or exception if the form specified in FormName could not be found. So please make sure that the form with such name are really exists.  
 
3. If you dinamically creating the form which you wish to embed to some container at run-time, don't forget to this form an unique name, to let the component to identify it withing the application.  
Example:  
MyNewForm := TMyForm.Create(Application);  
MyNewForm.Name := 'myform' + UniqueId; // <-- give it unique name  
acEmbeddedForm1.FormName := MyNewForm.Name;  
 
4. If you would like to embed the form to ActiveX form, please make sure that form which you would like to embed automatically created before the ActiveX form displayed. Unfortunately ActiveX projects does not create all VCL forms automatically, so you should add some of following code to your ActiveX project:  
library YourActiveXFormLibrary;  
 
uses  
  Forms, // <-- this will allows to use an "Application" object  
  ComServ,  
 
// -- snip --  
 
{$E ocx}  
 
exports  
  DllGetClassObject,  
  DllCanUnloadNow,  
  DllRegisterServer,  
  DllUnregisterServer;  
 
{$R *.TLB}  
 
{$R *.RES}  
 
begin  
  Application.CreateForm(TForm1, Form1); // <-- this will auto-create additional VCL forms  
end.