cancel
Showing results for 
Search instead for 
Did you mean: 

Update flex button from a view to custom container

matheuschiarelli
Associate II

Hello!

I've been having some problems to update a flex button inside a custom container that i created and used as template in a scroll list.

 

My goal is: select an item in scroll list by hardware button, and change the state of a flex button from "Released" to "Pressed" and vice-versa.

Issue: the function that i use to update the items only update when the scroll movement is made, create another function to send the button's update command to the container didn't work.

 

I need to update the button state immediatly with a button click, how can i do this? 

My code:

//My container void RoutingContainer::setListElements(int item) { //Function to define items in scroll list switch (item) { case 0: channel_number.setTypedText(TypedText(T_RESOURCEID1)); break; case 1: channel_number.setTypedText(TypedText(T_RESOURCEID2)); break; case 2: channel_number.setTypedText(TypedText(T_RESOURCEID3)); break; case 3: channel_number.setTypedText(TypedText(T_RESOURCEID4)); break; case 4: channel_number.setTypedText(TypedText(T_RESOURCEID5)); break; case 5: channel_number.setTypedText(TypedText(T_RESOURCEID6)); break; case 6: channel_number.setTypedText(TypedText(T_RESOURCEID7)); break; case 7: channel_number.setTypedText(TypedText(T_RESOURCEID8)); break; } } void RoutingContainer::setButtonState(bool pressed) //Function to change the buttons state { btn_left.setPressed(pressed); btn_left.invalidate(); }
View more



//View //This function only updates when the scroll is made, and it's the only way i can update the widgets (i guess) void routing_channelView::scrollList1UpdateItem(RoutingContainer& item, int16_t itemIndex) { item.setListElements(itemIndex); if (itemSelected && (itemIndex == listIndex)) { item.setButtonState(true); } else { item.setButtonState(false); } } void routing_channelView::selectOption() { itemSelected = true; }

 

0 REPLIES 0