Sign in Join

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

Mailing lists / lazarus / 2011-12

Strange behavior on creationg TMenuItem

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Everton Vieira

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20111202/7a48bae5/attachment.html>

Reply by email

Flávio Etrusco
to Everton Vieira

2011/12/2 Everton Vieira :

Show quoted text 19 lines
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

Reply by email