[Lazarus] Custom Form design time rendering problem
Horacio Jamilis
hjamilis at pymesoft.com.ar
Tue Jun 2 00:01:13 CEST 2015
Hi,
I am migrating a Delphi system to Lazarus.
Each object of the system is represented in a TFrame.
The declaration of TSystemObject (base object/frame) is:
{$ifdef BASE_SYSTEMOBJECT_ON_OBJECT}
TSystemObject = class(TObject)
{$else}
TSystemObject = class(TFrame)
{$endif}
public
constructor Create(AOwner : {$ifdef
BASE_SYSTEMOBJECT_ON_OBJECT}TObject{$else}TComponent{$endif}); {$ifdef
BASE_SYSTEMOBJECT_ON_OBJECT}virtual;{$endif}
constructor CreateObject(aOwner : {$ifdef
BASE_SYSTEMOBJECT_ON_OBJECT}TObject{$else}TComponent{$endif}{; const
aSystemData : TSystemData = nil}); virtual;
end;
The conditional BASE_SYSTEMOBJECT_ON_OBJECT make it act as a frame at
design time, and as a TObject at runtime. Then at runtime I create the
designed frame by code when required.
In Delphi (any version) it works. In Lazarus, I can not see the
components at design time (I don't know at runtime because I did not
finished the porting and does not compile yet).
I registered it with
FormEditingHook.RegisterDesignerBaseClass(TSystemObject);
The registration went well! I installed the package ok. The properties
of the TSystemObject are on the object inspector as expected.
When I open a unit with a SystemObject created in Delphi, it opens, but
the components inside it (in the frame) are not rendered at design time.
I can select them with a mouse clic, and the properties of them are ok
in the object inspector, but the component is not visible on the form.
Even if I add a TButton, it is not visible.
What could be wrong?
Using .dfm in place of .lfm could be a problem?
Then I changed the base class to TForm (in place of TFrame), and
registered it as in the custom form example with
RegisterCustomForm(TSystemObject,'SystemObject');
This worked as it appears in the new menu dialog. How to do this with
TFrame?
Thank you!
Horacio Jamilis
Buenos Aires, Argentina
More information about the Lazarus
mailing list