How can I work with ‘packages dynamically loaded’ which contain forms inside them?

Written by admin

The executable you are going to use to load those dynamical packages (dpl, bpl) must have enabled the ‘Build with runtime packages‘ option, besides, on the edition’s field corresponding to this option must appear the name of the JfControls’ package(s) that that executable will use, thus: JfCtrls_d6;JfCtrlsGrid_d6

This option should be at ‘Project Options‘ / Packages Tab.

In addition, this edition’s field must also include all those packages of Delphi you also want to use along your application.

You must register each and every package’s unit (dpl, bpl) with a form inside as follows:

initialization
  RegisterClass(TFrForm1);
finalization
  UnRegisterClass(TFrForm1);

To create those forms within the dynamical packages, you should use the following JfControls functions:

procedure JfWndPkgCreate(AOwner: TCustomForm; var AForm: TForm; ALibrary: String; AFormClass: String; ACenterOptions: TJfCenterOptions);
procedure JfWndPkgCreateModal(AOwner: TCustomForm; var AForm: TForm; ALibrary: String; AFormClass: String; ACenterOptions: TJfCenterOptions);
procedure JfWndPkgShow(AOwner: TCustomForm; var AForm: TForm; ALibrary: String; AFormClass: String; ACenterOptions: TJfCenterOptions);
function JfWndPkgShowModal(AOwner: TCustomForm; var AForm: TForm; ALibrary: String; AFormClass: String; ACenterOptions: TJfCenterOptions): TModalResult;

For instance:

 TFrMain = class(TForm)
    JfCApp: TJfCApplication;
    CForm: TJfCForm;
    JfSpeedButton1: TJfSpeedButton;
    JfSpeedButton2: TJfSpeedButton;
    procedure JfSpeedButton1Click(Sender: TObject);
    procedure JfSpeedButton2Click(Sender: TObject);
    procedure CFormFormDestroy(Sender: TObject);
  private
    { Private declarations }
    f1, f2: TForm;
  public
    { Public declarations }
  end;
procedure TFrMain.JfSpeedButton1Click(Sender: TObject);
begin
  JfWndPkgShow(Self, f1, 'FormsPkg.dpl', 'TFrForm1', ceoPriorWindow);
end;
procedure TFrMain.JfSpeedButton2Click(Sender: TObject);
begin
  JfWndPkgShow(Self, f2, 'FormsPkg.dpl', 'TFrForm2', ceoPriorWindow);
end;
procedure TFrMain.CFormFormDestroy(Sender: TObject);
begin
  if Sender = f1 then f1 := nil;
  if Sender = f2 then f2 := nil;
end;
Select a package!
Select a package!

You may also like…

JfControls 21.07.09 released

JfControls 21.07.09 released

Today we are excited to introduce the new version of JfControls 21.07.09 compatible with RADStudio 10.4. Improvements ... ⦁ Improvements in compatibility with Delphi 10.3.3 and CBuilder 10.3.3 (32Bit & 64Bit). ⦁ Compatibility with Delphi 10.4 and CBuilder 10.4...

RAD Studio 10.4 is Here

RAD Studio 10.4 is Here

RAD Studio 10.4 Radically Improves Native Windows Development We are pleased to announce the General Availability of RAD Studio 10.4. Version 10.4 brings significant improvements for Windows 10 VCL (Visual Component Library) desktop development, Delphi multi-device...

JfControls 20.08.21 released

JfControls 20.08.21 released

Today we are excited to introduce the new version of JfControls 20.08.21 compatible with RADStudio 10.3.2. Improvements ... ⦁ Improvements in compatibility with Delphi 10.2.3 and CBuilder 10.2.3 (32Bit & 64Bit). ⦁ Compatibility with Delphi 10.3.2 and CBuilder...

0 Comments

Submit a Comment