cancel
Showing results for 
Search instead for 
Did you mean: 

It is possible to pass a value from view to container

matheuschiarelli
Associate II

Hello.

I have a project on TouchGFX Designer, in a view (called routing_channel) i have a ScrollList with a container that i use as template.

I am doing the scroll with hardware buttons, my goal is, get the index value from the items of the list and pass this value to container.

How can i pass values from view to container? 

example:

ScrollList
item1
item2 < Selected this item, now i want to pass his index value to the container
item3

If my goal isn't clear enough, i can provide more details. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
matheuschiarelli
Associate II

Hello, @LouisB 

Actually i solved the problem by following this other topic. My problem was with the list update function, same as the topic's question.

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-scroll-list-invalidate-problem-stm32h750b-dk/m-p/687465#M38158

Sorry for any inconvenience.

View solution in original post

4 REPLIES 4
LouisB
ST Employee

Hello @matheuschiarelli,

When you say "scroll with hardware buttons", it means that, you go from one item to another by using buttons or the scroll itself is done by buttons ?

If that's the first case with a scroll list, one solution is to keep track of the current element by using a cursor that you increment and decrement each time the button is clicked. You can use "animateToItem" like:

 

 

...
void MyScreen::buttonUp()
{
   if(cursor < MAXCURSOR)
   {
      cursor ++;
      scrollList1.animateToItem(cursor);
      #DO_MY_THING_WITH_CONTAINER
   }
}
...

 

 

I hope it helps,
BR,

Louis BOUDO
ST Software Developer | TouchGFX

Hello @LouisB 

Actually, the scroll itself is done by buttons. To be more specific in my goal: I have some Flex Buttons in container that i want to change their value (from "released" to "pressed" for example) by sending boolean value from view to container. I mentioned the scroll because my display doesn't have touch, so i need to get the scroll item's value by hardware button (if is possible).

I was trying this:

//Function example in container
void RoutingContainer::setButtonState(bool pressed)
{
    btn_left.setPressed(pressed);
    btn_left.invalidate();
}

 

//Function example in view

void routing_channelView::sendValueToContainer(RoutingContainer& item)
{
	item.setButtonState(true);
}

LouisB
ST Employee

Hello @matheuschiarelli ,

I saw that you create this thread Update flex button from a view to custom container - STMicroelectronics Community for the same issue. Please don't do duplicated thread for the same question.

There's some things I don't understand, which function is called when you click ? and how do you know which element is the current one ? You can also check the example in Designer and draw inspiration from it.

BR,

Louis BOUDO
ST Software Developer | TouchGFX
matheuschiarelli
Associate II

Hello, @LouisB 

Actually i solved the problem by following this other topic. My problem was with the list update function, same as the topic's question.

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/touchgfx-scroll-list-invalidate-problem-stm32h750b-dk/m-p/687465#M38158

Sorry for any inconvenience.