cancel
Showing results for 
Search instead for 
Did you mean: 

How to scroll ScrollableContainer with hardware button?

qqAnton
Senior

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

6 REPLIES 6
Martin KJELDSEN
Chief III

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
Chief III

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

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)

Hello Martin,

I have a problem, it works well when I scroll the text, which I wrote in TouchGFX Designer,

but when I change the text for this one:

Unicode::snprintf(textArea1Buffer, 600, "test1\ntest2\ntest3\ntest4\ntest5\ntest6\ntest7\ntest8\ntest9\ntest10\ntest11\ntest12\ntest13\ntest14\n");
textArea1.invalidate();

I can scroll some lines, but then I get:

0690X000008j3VXQAY.jpg How could I resolve the problem?

Anton

I'm curious about this too as I'm facing similar issues.