Skip to main content
Yunus ARI
Senior
November 11, 2019
Solved

How can I do scrolling text?

  • November 11, 2019
  • 2 replies
  • 3020 views

Hi,

I want to do a scrolling text. I think, I can use "scrollable container". But how can I scroll automatically don't know.  Is there any example about this type of usage for scrollable container? 

This topic has been closed for replies.
Best answer by Martin KJELDSEN

Is the only function of this text to scroll automatically? Then just have textarea and a move animator with a container to act as a viewport

  1. Drag in a container through the designer and resize it to your needs.
  2. Dump a TextArea inside the container and move it to its starting position
  3. Create an interaction that movies it

Is that too simple? Not really sure what this thing is supposed to do :)

/Martin

2 replies

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
November 11, 2019

Is the only function of this text to scroll automatically? Then just have textarea and a move animator with a container to act as a viewport

  1. Drag in a container through the designer and resize it to your needs.
  2. Dump a TextArea inside the container and move it to its starting position
  3. Create an interaction that movies it

Is that too simple? Not really sure what this thing is supposed to do :)

/Martin

Yunus ARI
Yunus ARIAuthor
Senior
November 12, 2019

Hi Martin,

I noticed that I don't know how to use move animation class when you said that it's too simple :grinning_face_with_sweat: I did some research and find an example which use move animation class. Now I did like you said, used a text with move animation in a container.

It's really too simple, thank you for advice. :beaming_face_with_smiling_eyes: 

Martin KJELDSEN
Principal III
November 12, 2019

Glad you were able to work it out! :)

/Martin

KMili
Associate III
November 11, 2019

It that is about ScrollableContainer, you can explicitly call smth like this:

const GestureEvent evt(GestureEvent::SWIPE_VERTICAL, -10, 0, 0);
scrollCont.handleGestureEvent(evt);

Or implement derived class of ScrollableContainer and implement your methods. For example, I have:

bool AdvancedScrollableContainer::scroll(int16_t deltaX, int16_t deltaY)
{
 return doScroll(deltaX, deltaY);
}
 
void AdvancedScrollableContainer::moveRelative(int16_t deltaX, int16_t deltaY)
{
 scrolledXDistance += deltaX;
 scrolledYDistance += deltaY;
 moveChildrenRelative(deltaX, deltaY);
 
 invalidateScrollbars();
}

Yunus ARI
Yunus ARIAuthor
Senior
November 12, 2019

I tried GestureEvent but can't run it. Move animation fixed the problem. Thank you for reply.