Skip to main content
June 20, 2019
Question

How to scroll ScrollableContainer with hardware button?

  • June 20, 2019
  • 6 replies
  • 2148 views

Hello,

1) Is it posible to scroll text in ScrollableContainer using hardware buttons?

I only found doScroll function to call it when the button is pressed, but it is private.

2) I need to scroll like 10-15 lines of texts and I need an opportunity to change text sometimes.

What widgets I should use?

Should I create a custom container for every line or use List layout.

I need something similar to TouchGFX ListLayout Example, but without icons and buttons

How could I change text in lines?

Anton

This topic has been closed for replies.

6 replies

Martin KJELDSEN
Principal III
June 20, 2019

Hi Anton,

Let me give you a quick rundown before getting into specifics tomorrow.

You have the source code for ScrollableContainer so you could simply make doScroll public or create a new method that calls doScroll with some arguments.

Yes, you can use hardware to do it. Check out the sticky on integrating hardware with your UI. You'll find that you should create a task to sample your buttons and use a message queue to send the event which will be checked by the GUITask in Model::tick(). You can also simply poll the button inside Model::tick() but then this call to sample the button will be part of your render-time of your current frame. (Or make it interrupt based - There are examples in the sticky for both solutions).

/Martin

Martin KJELDSEN
Principal III
June 21, 2019

Hi @qqAnton​,

You might want to use a ScrollList instead of a ScrollableContainer. Here's an article on it: https://touchgfx.zendesk.com/hc/en-us/articles/360018095032-Scroll-List. You also have the source code for it.

/Martin

June 21, 2019

Hello Martin,

I tried to make doScroll public,

and call

scrollableContainer1.doScroll(0,-5);

when button is pressed to scroll down, and it works! Thank you

I saw the article about Scroll List, but I dont know what function I should call to scroll, something like doScroll?

Now I am trying to change the text in scrollableContainer, but I have some problems because the text is child of container. (Resolved)