461 views
in Getting started by
Hello,

My objective is to configure the "Reset" Button on "vertical list 2" example in a way that it would change the others items listed (switch buttons and sliders) to a default configuration (all buttons activated and sliders on zero for example).

I'm trying to do it adding a slot method to this Reset Button, but I'm couldn't find a way to set the others widgets the way I want it.

How can I do it?

 

Thanks in advance,

Lucas

1 Answer

+1 vote
by

Hello Lucas,

the example "vertical list 2" demonstrates the (dynamically) creation of a vertical list that contains different types of items within the list. This approach is useful in case you have a variable number of list items (e.g. from a data base). 

In this case, this example can be enhanced to connect each item with a property of a device class so that it can query its current value and change the value after some user interaction. For that purpose, the application has to provide additional methods GetItemValue() to return a reference to an int32 property that can be used for slider items to read/write their value, a method GetItemStatus() to return a bool property that can be used for switch items to read/write their status and a method GetItemAction() to return a slot method that can be used for button items.

The wrapper class has to be enhanced to forward the Action to a ButtonItem, to forward the Status to a SwitchItem and to forward the Value to a SliderItem.

The device class is the interface to the underlying ("real") machine and provides the data that is shown by the different list items. The method Reset() clears all values and states.

Here is the modified example.

Hope this helps...

Best regards,

Manfred.

 

by
It helps a lot Manfred, many thanks.

Best regards,

Lucas
by
Manfred,

I want to develop a scrip to turn some leds on and off based on what is selected in this vertical list, how can I call these Values and Status in my code?

I mean, the code is supposed to check the selected options and turn the leds on/off based on that.

Thanks in advance,

Lucas
by

Hi Lucas,

hmmm, not sure if I understand what you want to achieve...

The LEDs can be controlled within the Device Class - put your code into the native section within the different OnSet methods of the Status properties.

Manfred.

Embedded Wizard Website | Privacy Policy | Imprint

...