Board index » delphi » FindComponent return value

FindComponent return value

Hi everyone,

Right now I'm using
IF FindComponent(componentname) <> NIL

The compiler doesn't barf at this, but I'd like to verify that NIL is indeed
the return value if the component can't be found. The D1 docs don't mention
anything about that.

By,
Jan

-----------------------------------------------------------------------
Jan Doggen                Masters Software           mass...@xs4all.nl
P.O. Box 697              2300 RA  Leiden            The Netherlands
-----------------------------------------------------------------------
** Specialists in multimedia software for education and presentation **
-----------------------------------------------------------------------
Usage of this email address for commercial purposes costs US$ 50 per
message. By using this email address you agree to this condition.
-----------------------------------------------------------------------

 

Re:FindComponent return value


In article <6eb43u$l2...@news2.xs4all.nl>, Jan Doggen
<mass...@xs4all.nl> writes

Quote
>Hi everyone,

>Right now I'm using
>IF FindComponent(componentname) <> NIL

>The compiler doesn't barf at this, but I'd like to verify that NIL is indeed
>the return value if the component can't be found. The D1 docs don't mention
>anything about that.

Just call it with a nonexistant component name and watch the return
value that you get back.

Quote

>By,
>Jan

>-----------------------------------------------------------------------
>Jan Doggen                Masters Software           mass...@xs4all.nl
>P.O. Box 697              2300 RA  Leiden            The Netherlands
>-----------------------------------------------------------------------
>** Specialists in multimedia software for education and presentation **
>-----------------------------------------------------------------------
>Usage of this email address for commercial purposes costs US$ 50 per
>message. By using this email address you agree to this condition.
>-----------------------------------------------------------------------

--
Andrew James Johnson

Re:FindComponent return value


Jan Doggen heeft geschreven in bericht <6eb43u$l2...@news2.xs4all.nl>...

Quote

>Right now I'm using
>IF FindComponent(componentname) <> NIL

>The compiler doesn't barf at this, but I'd like to verify that NIL is
indeed
>the return value if the component can't be found. The D1 docs don't mention
>anything about that.

Why not try something like

var c : tcomponent;

c := findcomponent('DitHadIkOokWelKunnenBedenken');

and see what value c gets? (Assuming of course that no component called
DitHadIkOokWelKunnenBedenken actually exists, but I think that's a safe
bet...)

Patrick.
--
Using Delphi at http://www.dsebv.nl
Using Nikon at  http://www.multiweb.nl/~patrick.

Other Threads