[Lazarus] Change default component name

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed Oct 12 10:57:49 CEST 2011


Michalis Kamburelis schrieb:
> Michalis Kamburelis wrote:
>> Browsing the Lazarus sources, I didn't see any such way (it seems that
>> the logic to remove 'T' from ClassName is just hardcoded in some
>> places), so I'm guessing it's 2., but wanted to make sure :)
>>
> 
> To answer my own question, the logic is inside
> TCustomFormEditor.CreateUniqueComponentName, and there doesn't seem to
> exist a reasonable way to change it.

Right, you are not the only one having trouble with component names :-(

> In theory, I could try assigning my
> own Name in constructor looking at my Owner, but then I also need to
> make sure myself that the name is unique (add unique number suffix),
> opening a can of worms (since I would have to replicate part of
> TCustomFormEditor.CreateUniqueComponentName implementation then, and
> fear that it can change one day :).

I already had to copy and implement my own version, for the dockable IDE 
layout save/restore.

> I guess the class should just be renamed.

As a workaround, yes. But there should exist better means for dealing 
with component names, independent from the form designer (which is not 
normally part of an application).

DoDi





More information about the Lazarus mailing list