mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 05:39:14 +02:00
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:
parent
dc37a30cb1
commit
301ca8011f
@ -5,7 +5,11 @@ unit custforms;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms;
|
Classes, SysUtils, contnrs,
|
||||||
|
// LCL
|
||||||
|
Forms,
|
||||||
|
// IdeIntf
|
||||||
|
ProjectIntf, NewItemIntf, FormEditingIntf;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
|
|
||||||
@ -40,8 +44,6 @@ Procedure Register;
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses ProjectIntf,NewItemIntf,contnrs;
|
|
||||||
|
|
||||||
Const
|
Const
|
||||||
SAppFrameWork = 'Custom forms';
|
SAppFrameWork = 'Custom forms';
|
||||||
SInstanceOf = 'Create a new instance of %s';
|
SInstanceOf = 'Create a new instance of %s';
|
||||||
@ -170,6 +172,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
D:=TCustomFormDescr(CustomFormList[i]);
|
D:=TCustomFormDescr(CustomFormList[i]);
|
||||||
RegisterProjectFileDescriptor(TCustomFormFileDescriptor.Create(D),D.Category);
|
RegisterProjectFileDescriptor(TCustomFormFileDescriptor.Create(D),D.Category);
|
||||||
|
FormEditingHook.RegisterDesignerBaseClass(D.FFormClass);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms;
|
Classes, SysUtils, Forms;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
TInitFormAt = (ifaShow,ifaCreate,ifaActivate);
|
TInitFormAt = (ifaShow,ifaCreate,ifaActivate);
|
||||||
|
|
||||||
@ -53,8 +53,6 @@ Type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses custforms;
|
|
||||||
|
|
||||||
{ TAppForm }
|
{ TAppForm }
|
||||||
|
|
||||||
procedure TAppForm.InitForm;
|
procedure TAppForm.InitForm;
|
||||||
|
@ -1,19 +1,20 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<Package Version="2">
|
<Package Version="4">
|
||||||
<Name Value="appforms"/>
|
<Name Value="appforms"/>
|
||||||
|
<Type Value="RunAndDesignTime"/>
|
||||||
|
<AddToProjectUsesSection Value="True"/>
|
||||||
<Author Value="Michael Van Canneyt"/>
|
<Author Value="Michael Van Canneyt"/>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="5"/>
|
<Version Value="11"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
<UnitOutputDirectory Value="lib/"/>
|
<UnitOutputDirectory Value="lib"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<CodeGeneration>
|
<Parsing>
|
||||||
<Generate Value="Faster"/>
|
<SyntaxOptions>
|
||||||
</CodeGeneration>
|
<UseAnsiStrings Value="False"/>
|
||||||
<Other>
|
</SyntaxOptions>
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
</Parsing>
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Description Value="Demo package which shows the use of the lazcustforms package.
|
<Description Value="Demo package which shows the use of the lazcustforms package.
|
||||||
It registers 2 custom forms (TAppForm and TDBAppForm)"/>
|
It registers 2 custom forms (TAppForm and TDBAppForm)"/>
|
||||||
@ -30,10 +31,10 @@ It registers 2 custom forms (TAppForm and TDBAppForm)"/>
|
|||||||
</Item2>
|
</Item2>
|
||||||
<Item3>
|
<Item3>
|
||||||
<Filename Value="regappforms.pp"/>
|
<Filename Value="regappforms.pp"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
<UnitName Value="regappforms"/>
|
<UnitName Value="regappforms"/>
|
||||||
</Item3>
|
</Item3>
|
||||||
</Files>
|
</Files>
|
||||||
<Type Value="RunAndDesignTime"/>
|
|
||||||
<RequiredPkgs Count="4">
|
<RequiredPkgs Count="4">
|
||||||
<Item1>
|
<Item1>
|
||||||
<PackageName Value="LCL"/>
|
<PackageName Value="LCL"/>
|
||||||
@ -54,7 +55,6 @@ It registers 2 custom forms (TAppForm and TDBAppForm)"/>
|
|||||||
</UsageOptions>
|
</UsageOptions>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
<IgnoreBinaries Value="False"/>
|
|
||||||
</PublishOptions>
|
</PublishOptions>
|
||||||
</Package>
|
</Package>
|
||||||
</CONFIG>
|
</CONFIG>
|
||||||
|
@ -14,6 +14,7 @@ implementation
|
|||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
begin
|
begin
|
||||||
|
RegisterUnit('regappforms', @regappforms.Register);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
@ -31,10 +31,6 @@ Type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
|
||||||
custforms;
|
|
||||||
|
|
||||||
|
|
||||||
{ TDBAppForm }
|
{ TDBAppForm }
|
||||||
|
|
||||||
procedure TDBAppForm.OpenAllDatasets;
|
procedure TDBAppForm.OpenAllDatasets;
|
||||||
|
@ -5,22 +5,21 @@ unit regappforms;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, appform, dbappform;
|
custforms, appform, dbappform;
|
||||||
|
|
||||||
procedure RegisterAppForms;
|
procedure Register;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses custforms;
|
procedure Register;
|
||||||
|
|
||||||
procedure RegisterAppForms;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
RegisterCustomForm(TAppForm,'AppForms');
|
; // Do nothing. Custom forms are registered during initialization.
|
||||||
RegisterCustomForm(TDBAppForm,'AppForms');
|
// For some reason does not work if registered here.
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterAppForms;
|
RegisterCustomForm(TAppForm,'AppForms');
|
||||||
|
RegisterCustomForm(TDBAppForm,'AppForms');
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user