Can an array be defined as a property of a class?

214 views
asked Jun 27, 2017 in GUI Development by xaviesh
Hello,

        I currently have a class defined that holds information about a device property. This device property sometimes is a list and can contain a defined set of values. Currently, I have several properties defined (simple data types like integers, strings etc.) within this class. I'd like to meaningfully connect this array of values to this class to show that it's a list data type. I'm unable to create a property array. Is there anyway to accomplish this without having an outside array and looking it up. It's very cumbersome and error-prone to do this. I'd like the array to be encapsulated within this class if possible. If I can store a reference to the array that would be a good solution too, but I tried without success.

Thank you!

1 Answer

+1 vote
answered Jun 27, 2017 by Paul Banach
 
Best answer
Hi,

actually Chora dosn't support refereces to arrays. The unique workaround is to maintain the array within an object and store the object in variable, property, etc. In other words:

1. You create a 'data container' class with your array inside.

2. You create an object of the 'data container' class.

3. Having this object you can access the array. The object itself can be passes in method parameters and stored within properties, variables, etc.

Hope it helps you further

Best regards

Paul Banach
commented Jul 1, 2017 by xaviesh
Thank you, that helps!

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

...