213 views
in GUI Development by

Hi,

I have created multiple bitmaps and assigned them to Image1 to Image100. Lets say I want to move Image2 to an X,Y position I am doing this.

     this.Image1.Opacity = 20;
     this.Image1.Bounds.x1 = this.Arraybjects[1,10];
     this.Image1.Bounds.x2 = this.Arraybjects[1,10]+50.0;
 
     this.Image1.Bounds.y1 = this.Arraybjects[1,11];
     this.Image1.Bounds.y2 = this.Arraybjects[1,11]+50.0;

But I want to use a string variable for Image1 or Imagex. Try something like this, but I am getting an error.


    var int32  newImageNumber  =  1;
 
    var string img = "Image" + string( newImageNumber,     2 );

     this.img.Opacity = 200;
     this.img.Bounds.x1 = this.Arraybjects[1,10];
     this.img.Bounds.x2 = this.Arraybjects[1,10]+50.0;
 
     this.img.Bounds.y1 = this.Arraybjects[1,11];
     this.img.Bounds.y2 = this.Arraybjects[1,11]+50.0;

Basically I want to insert the string "img" in the middle of the expression above.

What is the best way to do this so that I don't have to type 100 times for each expression?

Thx

1 Answer

0 votes
by

Hello MMD,

this approach will not work. Chora is a static programming language. All expressions, references to variables, their data types, etc. have to be known at the compilation time. This guarantees that no hidden errors are included in the application which could then have fatal effect in the finished product. What can you do?

The members Image1 .. Image100 are views within the component. You can enumerate and access the views if necessary. See the section Enumerate and search views existing within the component.

From your question I assume, you are trying to create a kind of scrollable image list, right? If this is the case, you can take a look at the Horizontal List, Vertical List or the Outline Box. All are components optimized to scroll contents.

Does it help you further?

Best regards

Paul Banach

by
Hi Paul,

Thanks for your response, but the images are to be displayed in more random positions. The scroll will not be the best of choice. I will look into the "Enumerated search views" see if it can be displayed randomly on the screen.

Thanks,

mmd

Embedded Wizard Website | Privacy Policy | Imprint

...