748 views
in GUI Development by
Hi,

I need to have a table of measured values which consists of 4 columns such as serial no and various types of measured values in a single row. Each measurements have declared as separate property in the device class. So I need to connect those properties dynamically to each columns. For example, when the first measured values arrive, the table should be displayed with one row and each column should have the measured value. if next set of measured values come then it should be displayed with two rows consists of previous measured values and current values. Likewise it should update dynamically. I have implemented the vertical list option and designed the view. But it doesn't  work properly.  Could you please help me to have this functionality in the GUI.

Regards,

Sazna.

1 Answer

+1 vote
by

Hello Sazna,

if I understood your application case correctly, you will need to implement a kind of storage for all the values collected (measured) in the past. Exposing the recent value in Device Class and connecting it with an list item is not sufficient. Vertical List is not able to retain the values by itself. It is just a view to some data managed externally. Please recall the Vertical List OnLoadItem method which acts as the glue between the list and the data. The list uses this method to initialize (to load) the actually visible items. The content of the items however is not persistent. The list reloads, discards and reuses the items if necessary. For example, when the user scrolls the list back, then older values need to be reloaded.

In the simplest case you can implement such storage by using an array. An additional variable can act as counter of entries already occupied in the array. Each time a new measurement is made, the corresponding values are stored in the next free entry of the array and the counter is incremented. When the array is full you could continue writing the new entries from the beginning of the array (like a ring buffer). Or you stop the measurements. The exact behavior will surely depend on your application case. In any case, however, we have to consider that RAM is finite.

Then implement the OnLoadItem method so it uses the values stored in the array. When the Vertical List requests the item #N to be loaded, then load the item with data values stored in the array entry #N (or #N modulo capacity of the array if you implement a ring buffer).

Finally, when new data is stored in the array, inform the Vertical List about it. As long as new entries are added to the array, you increment the list's property NoOfItems. As soon as the array is full and you override older values with new values, the number of items does not change anymore. Only the content is exchanged. In such case invoke list's method InvalidateItems( 0, capacity of the array ) to force the list to reload all items.

I hope it answers your question.

Best regards

Paul Banach

by

Hello Sazna,

Is it a wrong approach?

Generally it is the right approach. The problem in your project was that you created an autoobject of the the Application component. The Application component, however, exists already. Using the autoobject will result in two instances of the Application component existing simultaneously at the runtime.

When you present a dialog and then you dismiss it, you will return to the (unique and always existing) Application component. When you plan to present different dialogs and switch between them, then you can manage the dialogs as autoobjects. Then you perform SwitchToDialog() referring the desired autoobject.

The main difference is thus between 'regular' components and the Application component, which always exists.

Does it help you further?

Best regards

Paul Banach

by

Hi Paul,

I want a clarification on the above vertical list update. when pressing enter the list should be added with one more item and it is saved to an array. Before adding the item to list I want to check whether the entered/selected item already in the list. If there is no existing item, then only I have to add to the list. How can I check that the user input is already exist in the array.?

 

Regards,

Sazna.

 

by
Hello Sazna,

probably enumerating the array entries and evaluating their contents would be the appropriate approach.

Best regards

Paul
by
Is evaluating the contents means a loop function? when having loop to check the content makes the list to update its ten items at once for a text input. Could you please explain the steps for your answer?

 

Regards,

Sazna.
by
I think yes, if you want to test whether a content is already stored in the array, you iterate the array items.

Best regards

Paul

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

...