On Fri, 8 Apr 2022, Marco van de Voort via lazarus wrote:


On 8-4-2022 10:49, Michael Van Canneyt via lazarus wrote:


But that is exactly what I want to support ?

If I want to implement my own button, descendent of the standard TButton or not:

Except for the restriction during streaming, I see no reason why I would
have to name my own button TMyButton, since the 'my' is implicit in the fact
that it is implemented in unit MyControls.

Have a virtual method in tpersistent that is used for the streaming identifier. Default it returns the classname (and everything remains the same for existing classes), and you can override it to also return the unitname.

You're even farther from home with this solution, because then you depend on
the user: 2 classes can return the same name.

Classname and unit name are a unique identifier, guaranteed to be unique (in your project) by the compiler itself.

Michael.
--
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to