Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Find a component by name

0 views
Skip to first unread message

Sten Karsten Vartdal

unread,
May 19, 1998, 3:00:00 AM5/19/98
to

On runtime, can I do anything like this:

With TObject.Name('B'+IntToStr(1)) as tSpeedButton do
begin
..
end;

Or can I scan to find it?

thanks.

--
Sten Karsten Vartdal
stenvart...@online.no
http://home.sol.no/~stenvart/

Maintainer of Delphi Help Page
http://home.sol.no/~stenvart/delphi.html

Andreas Klein

unread,
May 19, 1998, 3:00:00 AM5/19/98
to

i think you have to use

try
with TSpeedbutton(Form1.FindComponent('B1')) do begin
(...)
end;
except
end;

when Form1 is the Owner of the Speedbutton


--
Andreas Klein
eMail: a-k...@metronet.de

Sten Karsten Vartdal schrieb in Nachricht <6jsc2a$f2b$3...@o.online.no>...

Daniel Berg

unread,
May 19, 1998, 3:00:00 AM5/19/98
to

The object of your question in nearly perfect ;-)

function FindComponent(const AName: string): TComponent;

should do the thing
>
>

Bruce Swart

unread,
May 20, 1998, 3:00:00 AM5/20/98
to

Try FindComponent

Sten Karsten Vartdal wrote:
>
> On runtime, can I do anything like this:
>
> With TObject.Name('B'+IntToStr(1)) as tSpeedButton do
> begin
> ..
> end;
>
> Or can I scan to find it?
>
> thanks.
>
> --
> Sten Karsten Vartdal
> stenvart...@online.no
> http://home.sol.no/~stenvart/
>
> Maintainer of Delphi Help Page
> http://home.sol.no/~stenvart/delphi.html

--
Bruce Swart (br...@cm.co.za)
Systems Analyst

27-(0)31-3325541 (W)
27-(0)31-3325552 (F)

Computer Management (Pty) Ltd
85 Smith Street
Durban
South Africa
4001

0 new messages