671 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 - Archive

Welcome to the Ask Embedded Wizard archive. This community forum served us well for many years, but we've evolved our support approach!

Your resources:

The Embedded Wizard Online Documentation provides comprehensive documentation, tutorials, examples and ready-to-use software packages.

For dedicated assistance, explore our Embedded Wizard Product Support.

You can still browse the valuable discussions from our community history here.

Embedded Wizard Website | Privacy Policy | Imprint

...