Looking at all the comments, I apologize for leading some of you astray. Originally, I thought I would have to search for each speed button and then determine it's number and load the corresponding caption. I can see now that my code was unnecessarily complex. But I learned a lot from the exercise!...:-)
Thanks to all for their inputs. Tom Nesler Live long!... Code Well!... and Prosper!... V -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of David Smith Sent: Thursday, March 06, 2008 3:33 PM To: [email protected] Subject: Re: [delphi-en] Re: Locating Speedbutton controls If that works for you than why do you need a search method? I thought you needed to find each one based on dynamically changing criteria. That's the problem with only posting a snippet of what you're trying to accomplish. In answer to your question as to its practicality, I extensively used this technique for my apps user customization form, where I searched the form (in OnClose event) to find component tag values that had been set, then used the name with that value to write the changes to an ini file. That way I had a way of cancelling the changes if the user changed their mind about the modifications to the app. Dave Martin Wynne <[EMAIL PROTECTED]> wrote: Hi, > This ought to work a little better for you: > > For X:=0 to Form1.ComponentCount-1 do > If Form1.Components[X] is TSpeedbutton then > If (Form1.Components[X] as TSpeedbutton).Name = 'SpdBtn' + IntToStr(I) then > Case I of > 1: SpdBtn1.Caption := Strlist[0]; > 2: SpdBtn2.Caption := Strlist[1]; > etc.... I might be missing something, but how does that differ from simply doing: with Form1 do begin SpdBtn1.Caption := Strlist[0]; SpdBtn2.Caption := Strlist[1]; etc.... ? Martin. --------------------------------- Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. [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

