Author Topic: Dynamically inserting elements in a Class  (Read 426 times)


  • Jr. Member
  • **
  • Posts: 99
Dynamically inserting elements in a Class
« on: January 29, 2023, 03:18:30 am »

I have a relatively ambitious idea for a newcomer. This may not be possible, but I am trying to learn by investigating the limits.

Imagine, I have a folder where my lazarus project is stored. The project has a form with a panel and a richmemo. Additionally, I have defined a class called textblock with one member called text of type string.

Every time write something in the richmemo and hit enter, it creates a new instance of textblock in memory. See picture in attachment with title Image1.png please.

Now, I want to know if the following is possible; and if so how?

  • Add a new file called plugin.pas in the same directory where the main project is. This file will have a control (say a TTrackBar) defined in, with location, anchors, etc. Afterwards, if I recompile using command line, and start the executable file, then the corresponding control (in this example the TTrackBar) will appear in the panel. I understand that the plugin now has to access the main Form, (i know that it is called Form1), the panel, and create a control on top of it. But How do I do that?
  • If I now write in the Richmemo and hit enter, the original class textblock  will be extended to contain a new variable trackbarvalue of type integer. This variable name and type should also be defines inside plugin.pas . After that, the an instance of the new, extended  textblock  will be initialized, and the value of the TTrackBar should now be pushed in the class member variable instance of textblock .trackbarvalue . Is this possible? How do I do it? 

Thank you


  • Hero Member
  • *****
  • Posts: 12893
Re: Dynamically inserting elements in a Class
« Reply #1 on: January 29, 2023, 08:17:02 am »
type helpers.
 For plugins use iinterfaces...
« Last Edit: January 29, 2023, 09:54:39 am by Thaddy »
Who is responsable for that!! The caller or the callee.. Out! ya'll, NOW. In UTC time, please, so maybe Yesterday or tomorrow.


TinyPortal © 2005-2018