List Info

Thread: RE: Re: Locating Speedbutton controls




RE: Re: Locating Speedbutton controls
country flaguser name
United States
2008-03-06 15:50:16

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: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com [mailto: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com] On
Behalf Of David Smith
Sent: Thursday, March 06, 2008 3:33 PM
To: delphi-en%40yahoogroups.com">delphi-enyahoogroups.com
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 < groups%4085a.nildram.co.uk">groups85a.nildram.co.uk&gt; 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: delphi-en-unsubscribe%40yahoogroups.com">delphi-en-unsubscribeyahoogroups.com
Yahoo! Groups Links

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )