Designer issues with specialized TFrame classes. lazarus / 21-General ---------------------------------------------------------------------- papelhigienico · 2025-02-04 22:24 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. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   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: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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? ---------------------------------------------------------------------- MarkMLl · 2025-02-05 11:10 Only edit the initial TFrame descendant. If you attempt to do anything to one which has been instantiated onto a form you'll end up in a heck of a mess, which might include having to fix up your .lfm file with a text editor. The fact that instantiated frames aren't treated (at least by default) as read-only is a longstanding niggle with a number of us, who have learned to grit our teeth and work around the issues by only instantiating (e.g. into a panel or tabbed control) at runtime. I'd suggest not referring to "specialisation" in this context, since the term's been coopted to refer to generics etc. MarkMLl ---------------------------------------------------------------------- papelhigienico · 2025-02-05 20:26 Hi MarkMLl! Thank you by your advises. I'm looking for the best way to implement the desired feature, and for now, extend a TFrame still the best option. Furthermore, I discovered that I have to register the extented TFrame class into the IDE Form designer, doing something like this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i uses ..., FormEditingIntf; procedure Register;begin FormEditingHook.RegisterDesi gnerBaseClass(TFaceplateFrame);end;  Doing this, I was able to see the new properties added to my TFrame descendant class, in Frame design or in frame instances, even across IDE reinitializations. Now I have to figure out how to hide a propety in frame design time, but make property visible when Object Inspector is handling a FaceplateFrame instance. And sorry by my translations mistakes. I'll try don´t use "specialize" when I want to say "extend".