CustomForm: Register new properties also for designer so they remain in a form. Issue #30241, solution from Balázs Székely.

git-svn-id: trunk@58838 -
This commit is contained in:
juha 2018-09-03 06:47:57 +00:00
parent dc37a30cb1
commit 301ca8011f
6 changed files with 28 additions and 31 deletions

View File

@ -5,7 +5,11 @@ unit custforms;
interface
uses
Classes, SysUtils, Forms;
Classes, SysUtils, contnrs,
// LCL
Forms,
// IdeIntf
ProjectIntf, NewItemIntf, FormEditingIntf;
Type
@ -40,8 +44,6 @@ Procedure Register;
implementation
uses ProjectIntf,NewItemIntf,contnrs;
Const
SAppFrameWork = 'Custom forms';
SInstanceOf = 'Create a new instance of %s';
@ -170,6 +172,7 @@ begin
begin
D:=TCustomFormDescr(CustomFormList[i]);
RegisterProjectFileDescriptor(TCustomFormFileDescriptor.Create(D),D.Category);
FormEditingHook.RegisterDesignerBaseClass(D.FFormClass);
end;
end;

View File

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, Forms;
Type
TInitFormAt = (ifaShow,ifaCreate,ifaActivate);
@ -53,8 +53,6 @@ Type
implementation
uses custforms;
{ TAppForm }
procedure TAppForm.InitForm;

View File

@ -1,19 +1,20 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<Package Version="2">
<Package Version="4">
<Name Value="appforms"/>
<Type Value="RunAndDesignTime"/>
<AddToProjectUsesSection Value="True"/>
<Author Value="Michael Van Canneyt"/>
<CompilerOptions>
<Version Value="5"/>
<Version Value="11"/>
<SearchPaths>
<UnitOutputDirectory Value="lib/"/>
<UnitOutputDirectory Value="lib"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
</CompilerOptions>
<Description Value="Demo package which shows the use of the lazcustforms package.
It registers 2 custom forms (TAppForm and TDBAppForm)"/>
@ -30,10 +31,10 @@ It registers 2 custom forms (TAppForm and TDBAppForm)"/>
</Item2>
<Item3>
<Filename Value="regappforms.pp"/>
<HasRegisterProc Value="True"/>
<UnitName Value="regappforms"/>
</Item3>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="4">
<Item1>
<PackageName Value="LCL"/>
@ -54,7 +55,6 @@ It registers 2 custom forms (TAppForm and TDBAppForm)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
<IgnoreBinaries Value="False"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@ -14,6 +14,7 @@ implementation
procedure Register;
begin
RegisterUnit('regappforms', @regappforms.Register);
end;
initialization

View File

@ -31,10 +31,6 @@ Type
implementation
uses
custforms;
{ TDBAppForm }
procedure TDBAppForm.OpenAllDatasets;

View File

@ -5,22 +5,21 @@ unit regappforms;
interface
uses
Classes, SysUtils, appform, dbappform;
custforms, appform, dbappform;
procedure RegisterAppForms;
procedure Register;
implementation
uses custforms;
procedure RegisterAppForms;
procedure Register;
begin
RegisterCustomForm(TAppForm,'AppForms');
RegisterCustomForm(TDBAppForm,'AppForms');
; // Do nothing. Custom forms are registered during initialization.
// For some reason does not work if registered here.
end;
initialization
RegisterAppForms;
RegisterCustomForm(TAppForm,'AppForms');
RegisterCustomForm(TDBAppForm,'AppForms');
end.