[Lazarus] Strange behavior on creationg TMenuItem

Flávio Etrusco flavio.etrusco at gmail.com
Fri Dec 2 15:40:15 CET 2011


2011/12/2 Everton Vieira <tonvieira at gmail.com>:
> I've just make some like that:
>
> for i := 0 to 10 do
> begin
>   MenuItem := TMenuItem.Create(Self);
>   MenuItem.Caption := 'tst ' + IntToStr(i);
>   PopMenu.Add(MenuItem);
>   ShowMessage(MenuItem.Name);
> end;
>
> Despite the MenuItem is created in the PopMenu, the ShowMessage is showing
> blank.
>
> How can a TComponent be created with the Name being blank "".
> How can various TComponent being with the same blank Name "".
>
> Att.
> Everton Vieira.
>

A component doesn't requeire a name, it's only used by the form to
update its references (published fields) according to the components'
names.

-Flávio




More information about the Lazarus mailing list