Re: Manipulate objects by reference
- From: "Maarten Wiltink" <maarten@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 15 Sep 2005 10:18:57 +0200
"Adam Sandler" <corn29@xxxxxxxxxx> wrote in message
news:1126719218.807807.34420@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[...]
> for i := 0 to pred(ComponentCount) do
> if Components[i] is TwwDBEdit then
> Components[i].DataSource := ds;
>
> Like you mentioned .Name is avalable to Components in this context but
> it isn't clear to me that even though Delphi knows I'm working with
> TwwDBEdit types, wht are some of those type's properties not
> available???
Delphi does *NOT* know that you are working with a TwwDBEdit. *You* do,
because you've just tested for it.
Components[i] returns a TComponent. Every time. To use it as a TWhatever,
you have to cast it. You test beforehand so that you know the cast is
safe. The compiler does not look at the meaning of the cast, and does not
remember anything about it.
Groetjes,
Maarten Wiltink
.
- References:
- Manipulate objects by reference
- From: Adam Sandler
- Re: Manipulate objects by reference
- From: alanglloyd@xxxxxxx
- Re: Manipulate objects by reference
- From: Adam Sandler
- Manipulate objects by reference
- Prev by Date: glyphs - bmp
- Next by Date: Re: Problems appending EMF files
- Previous by thread: Re: Manipulate objects by reference
- Next by thread: Re: Manipulate objects by reference
- Index(es):
Relevant Pages
|