Hi everyone!
I'm creating a new control for PascalSCADA that will mimic a functionality of other engineering software in Lazarus. Lazarus has a similar feature (Frames). Knowing this, I started from TFrame, trying to specialize it to get new functions, but in this way, I'm doing something wrong in the process.
What I did:
1) Created the specialized TFrame class with the desired properties.
TFaceplateFrame = class(TFrame)
private
ffaceplatetag: TPLCStruct;
protected
procedure setfaceplateTag(AValue: TPLCStruct);
published
property FaceplatePLCTag: TPLCStruct read ffaceplatetag write setfaceplateTag;
end;
2) Registered a Lazarus project file descriptor using the function RegisterProjectFileDescriptor. The class TFaceplateFrameFileDescriptor inherits from TFileDescPascalUnitWithResource. Below is the constructor of the file descriptor:
constructor TFaceplateFrameFileDescriptor.Create;
begin
inherited Create;
Name := 'FaceplateFrame'; // do not translate this
ResourceClass := TFaceplateFrame;
RequiredPackages := 'pascalscada_hmi';
UseCreateFormStatements := True;
end;
What I expect:
After doing the previous steps, when I create a new TFaceplateFrame (using Lazarus menu File -> New, then choosing FaceplateFrame), the property FaceplatePLCTag should be visible on newly created TFaceplateFrame instances, in the TFaceplateFrame designer or even in TFaceplateFrame instances inside forms.
This happens on a freshly created TFaceplateFrame, but if I close and reopen the project, the FaceplatePLCTag property of my FaceplateFrame instances is lost and does not appear in the Object Inspector anymore.
So, someone can tell me what I'm doing wrong?