Hello!

I tried using this tip but I am getting a runtime error Einvalidcast
when I try to run my program.  The error is Invalid Type Cast.

It appears that it does not like the Name property.

Here is how I am using your suggestion:

 If (Sender as TSpeedbutton).Name = 'SpdBtn' + IntToStr(I+1) then
  begin
        case I+1 of
        1: SpdBtn1.Caption := Strlist[1];
        2: SpdBtn1.Caption := Strlist[2];
        ...

     End;
  End;

Any suggestions?

Tom Nesler

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Charlie Chambers
Sent: Wednesday, March 05, 2008 6:39 PM
To: [email protected]
Subject: Re: [delphi-en] Locating Speedbutton controls


Hi Tom,

i think your looking for:
if (Sender as TSpeedbutton).Name='SpdBtn1' then
   //do something


if you don't know the name of the component then when you create the
component set the Tag property to a known amount as 20-41 to find
components as

if (Sender as TSpeedbutton).Tag=21 then
   //do something

Or you can iterate through all the components on the form as


for C:=0 to Form1.ComponentCount-1 do begin
   if Components[C] is TSpeedbutton then begin
       //do something
   end;
end;

Cheers,
Charlie

  ----- Original Message ----- 
  From: Nesler, Thomas J 
  To: [email protected] 
  Sent: Wednesday, March 05, 2008 4:26 PM
  Subject: [delphi-en] Locating Speedbutton controls


  Hello!

  I have a Coolbar with 21speed buttons on it. I need to enter captions
  on the fly for these speedbuttons. How can I find these buttons and
  load the captions?

  I know there is some kind of search find function but I can't seem to
  locate it right now.


  Thanks in advance!

  Tom Nesler


  [Non-text portions of this message have been removed]



   

[Non-text portions of this message have been removed]



-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links



Reply via email to