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

Written by Jose Antonio

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;

Version: 1.0.0

Size: 28 KB

Published: August 12, 2020

Packages Dynamically loaded Sample (Delphi 3)

Available in: JfControls Standard, Developer and Professional


Version: 1.0.0

Size: 30 KB

Published: August 12, 2020

Packages Dynamically loaded Sample (Delphi 5)

Available in: JfControls Standard, Developer and Professional


Version: 1.0.0

Size: 30 KB

Published: August 12, 2020

Packages Dynamically loaded Sample (Delphi 6)

Available in: JfControls Standard, Developer and Professional



You may also like…

Enterprise application development

Enterprise application development

Para el desarrollo de aplicaciones empresariales se necesitan herramientas que tengan las siguientes características: Flexibilidad, adaptabilidad, facilidad, capacidad de expansión.Soporte de múltiples tipos de dispositivos.Capacidad de reacción ante los cambios que...

JfControls 23.01.10 released

JfControls 23.01.10 released

Improvements ... ⦁ Compatibility with Delphi 11.0 and CBuilder 11.0 (32Bit & 64Bit).. Fixed ... ⦁ Minor bug fixes. We wanted to release a new version of compatibility with Delphi 11.0 and CBuilder 11.0 before releasing a new version that will bring many important...

What’s Coming in 10.4.2 Sydney

What’s Coming in 10.4.2 Sydney

Am I the only one who gets excited about new releases? If you look at the RAD Studio Roadmap you will see a new 10.4.2 release of Sydney is scheduled for the first half of 2021. If you are on Update Subscription then you were invited to the NDA 10.4.2 Hunter beta....

0 Comments

Submit a Comment