On Wed, 4 Oct 2006 23:33:48 -0300
"Felipe Monteiro de Carvalho" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I was implementing TMenu for Qt, when I got a little confused by
> component arrays.
>
> On the file menu.inc I see this:
>
> procedure TMenu.CreateHandle;
> var i: integer;
> begin
> FItems.Handle := TWSMenuClass(WidgetSetClass).CreateHandle(Self);
> // initiate creation of subitems
> // Note: FItems is a TMenuItem. Using HandleNeeded will create all
> subitems. for i:=0 to Items.Count-1 do
> if Items[i].Visible then
> Items[i].HandleNeeded;
> end;
>
> And here is how Items is declared on this class:
>
> FItems: TMenuItem;
> ..............
> property Items: TMenuItem read FItems;
>
> My doubts are:
>
> 1 ) Can I just take a property and use it as an array like that??
Yes, because TMenuItem has a default property.
> Shouldn't that property be declared like this:
>
> property Items[Index: Integer]: TMenuItem read FItems;
No, because TMenuItem has this already.
> 2) And if it was declared like above, shouldn't FItems be an array of
> TMenuItem ?
No, why?
> Are TComponent descendents naturally arrayable or something like that?
No.
Mattias
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives