294 views
in GUI Development by
Good day,

 

Is it possible to programatically create multiple instances of an ExternBitmap resource as well as multiple instances of an Image view in Chora?

If so, would it be possible you could please point me to the relevant section in the help?

I would like to dynamically add bitmaps to the screen which are determined at runtime.

 

Kind Regards,

Rob

1 Answer

0 votes
by

Hi Rob,

it is possible. With the new operator you can create instances of any Chora class. Once the instance is available you can access its properties, etc.. For example, to create dynamically an instance of ExternBitmap and an imstance of Image view do following:

var Resources::ExternBitmap bitmap = new Resources::ExternBitmap;
var Views::Image            image  = new Views::Image;

// Initialize the bitmap
bitmap.Name = "Some extern bitmap name";

// Connect the bitmap to the image view and configure the image view
// to appear at position 10,10 with 100x100 pixel size
image.Bitmap = bitmap;
image.Bounds = <10,10,110,110>;

Once the image view is create you can add it to the component where you want it to be displayed:

Add( image, 0 )

See also: Compose the component programmatically

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...