Board index » delphi » HELP - Easy Delphi problem

HELP - Easy Delphi problem

Hi

I'm a newbie to Delphi, and want to achieve the following:

form1.image1:=40;
form1.image2:=67;
form1.image3:=30;

and so on up to form1.image438

The variables on the right hand side will come from an array.

There must be an easy way, but I can't seem to find it. I am using Delphi
4.0 Standard Edition.

Any help will be greatly appeciated.

Thanks

Paul

http://www.zfree.co.nz

 

Re:HELP - Easy Delphi problem


Oops, I meant:

form1.image1.left:=40;
form1.image2.left:=67;
form1.image3.left:=30;

Quote
Quivis <qui...@ask.me.first> wrote:
>On Tue, 26 Mar 2002 17:10:31 GMT, Delphi Newbie had this to say...

>-> form1.image1:=40;
>-> form1.image2:=67;
>-> form1.image3:=30;
>->
>-> and so on up to form1.image438
>->
>-> The variables on the right hand side will come from an array.
>->
>-> There must be an easy way, but I can't seem to find it. I am using Delphi
>-> 4.0 Standard Edition.

>There probably is, provided you tell us what it is you're trying to
>do. You cannot, however, assign an integer value to a TImage, like you
>did above.

>Quivis.
>--
>SPAM goes here : root@localhost
>Freeware       : Revix (indexing, renaming, personalizing of images)
>Web Space      : http://www.bahnhof.se/~smars/quivis/index.html

http://www.zfree.co.nz

Re:HELP - Easy Delphi problem


Quote
"Delphi Newbie" <paul.robe...@zfree.co.nz> wrote in message

news:3ca0ab7b@zfree.co.nz...

Quote
> and so on up to form1.image438

> The variables on the right hand side will come from an array.

(Form1.FindComponent ('Image' + IntToStr (imageIndex)) as tImage).Left :=
ImageXPosition [imageIndex];

Re:HELP - Easy Delphi problem


Look into FINDCOMPONENT.

"Quivis" <qui...@ask.me.first>
???????:MPG.170b05089c07cba98a...@207.14.113.10...

Quote
> On Tue, 26 Mar 2002 20:48:54 GMT, paul.robe...@zfree.co.nz had this to
> say...

> ->
> -> Oops, I meant:
> ->
> -> form1.image1.left:=40;
> -> form1.image2.left:=67;
> -> form1.image3.left:=30;

> Provided you have an array, MyArray, filled with integer values, you
> can do something like:

> for I := 0 to Form1.ComponentCount - 1 do
>   if Components[I] is TImage then
>     TImage(Components[I]).Left := MyArray[I];

> The array needs to be at least as large as the number of components,
> but it doesn't matter if it's larger, although it's a waste of space.
> Then again, RAM is cheap these days... ;-)

> HTH

> Quivis.
> --
> SPAM goes here : root@localhost
> Freeware       : Revix (indexing, renaming, personalizing of images)
> Web Space      : http://www.bahnhof.se/~smars/quivis/index.html

Other Threads