2025-02-21 11:45 AM
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!
Solved! Go to Solution.
2025-03-05 3:54 AM - edited 2025-03-05 3:55 AM
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.
2025-02-24 12:32 AM - edited 2025-02-24 12:34 AM
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,
2025-02-24 3:05 AM
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);
}
.
2025-03-04 6:16 AM
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,
2025-03-05 3:54 AM - edited 2025-03-05 3:55 AM
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.