Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2025-02

Designer issues with specialized TFrame classes.

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Fabio Luis Girardi

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.

   1.   TFaceplateFrame = class(TFrame)
   2.   private
   3.     ffaceplatetag: TPLCStruct;
   4.   protected
   5.     procedure setfaceplateTag(AValue: TPLCStruct);
   6.   published
   7.     property FaceplatePLCTag: TPLCStruct read ffaceplatetag write
    setfaceplateTag;
   8.   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:

   1. constructor TFaceplateFrameFileDescriptor.Create;
   2. begin
   3.   inherited Create;
   4.   Name := 'FaceplateFrame'; // do not translate this
   5.   ResourceClass := TFaceplateFrame;
   6.   RequiredPackages := 'pascalscada_hmi';
   7.   UseCreateFormStatements := True;
   8. 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.

Can someone tell me what I am doing wrong? Any help is appreciated.

The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20250204/eded9f09/attachment.htm>

Reply by email

Mattias Gaertner
to Fabio Luis Girardi
Fabio Luis Girardi wrote 21 lines
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. 1. TFaceplateFrame = class(TFrame) 2. private 3. ffaceplatetag: TPLCStruct; 4. protected 5. procedure setfaceplateTag(AValue: TPLCStruct); 6. published 7. property FaceplatePLCTag: TPLCStruct read ffaceplatetag write setfaceplateTag; 8. end;

See
https://wiki.freepascal.org/Extending_the_IDE#Forms

[...]

Mattias

Reply by email

Fabio Luis Girardi
to Mattias Gaertner

Hi Mr. Gaertner!

Reading the wiki, I realized that the following code is missing:

uses FormEditingIntf...
procedure Register;begin
 FormEditingHook.RegisterDesignerBaseClass(TFaceplateFrame);end;

After adding this part, I was able to see the new Frame properties after the IDE restart.

Thank you

Em qua., 5 de fev. de 2025 ?s 06:00, Mattias Gaertner via lazarus <

Show quoted text 41 lines
escreveu: On 2/4/25 23:37, Fabio Luis Girardi via lazarus wrote: > 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. > > 1. TFaceplateFrame = class(TFrame) > 2. private > 3. ffaceplatetag: TPLCStruct; > 4. protected > 5. procedure setfaceplateTag(AValue: TPLCStruct); > 6. published > 7. property FaceplatePLCTag: TPLCStruct read ffaceplatetag write > setfaceplateTag; > 8. end; See https://wiki.freepascal.org/Extending_the_IDE#Forms >[...] Mattias -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus
The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20250205/dd007679/attachment.htm>

Reply by email

Fabio Luis Girardi
to Fabio Luis Girardi

Hi again!

One last question: There is some way to disable the editing of TFaceplateFrame instances inside a form?

Em qua., 5 de fev. de 2025 ?s 17:09, Fabio Luis Girardi <

Show quoted text 71 lines
escreveu: Hi Mr. Gaertner! Reading the wiki, I realized that the following code is missing: uses FormEditingIntf... procedure Register;begin FormEditingHook.RegisterDesignerBaseClass(TFaceplateFrame);end; After adding this part, I was able to see the new Frame properties after the IDE restart. Thank you Em qua., 5 de fev. de 2025 ?s 06:00, Mattias Gaertner via lazarus < > escreveu: > > > On 2/4/25 23:37, Fabio Luis Girardi via lazarus wrote: > > 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. > > > > 1. TFaceplateFrame = class(TFrame) > > 2. private > > 3. ffaceplatetag: TPLCStruct; > > 4. protected > > 5. procedure setfaceplateTag(AValue: TPLCStruct); > > 6. published > > 7. property FaceplatePLCTag: TPLCStruct read ffaceplatetag write > > setfaceplateTag; > > 8. end; > > See > https://wiki.freepascal.org/Extending_the_IDE#Forms > > >[...] > > Mattias > > -- > _______________________________________________ > lazarus mailing list > > https://lists.lazarus-ide.org/listinfo/lazarus > -- The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com
The best regards, Fabio Luis Girardi PascalSCADA Project http://sourceforge.net/projects/pascalscada http://www.pascalscada.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20250205/38f9c4e4/attachment.htm>

Reply by email