Skip to main content
RMoha.2
Associate III
July 14, 2020
Solved

Elements in ListLayout view

  • July 14, 2020
  • 2 replies
  • 1267 views

When adding elements to a ListLayout(which is configured to scroll vertically "SOUTH"), the newest elements is added to the bottom, which is fine. However, what is constantly remaining on the top of the view is the first(oldest) element and the subsequent older. As such, the content is larger than the height, the newest element will be hidden till manually scrolling the list.

Is there a way to make the list automatically updates "i.e. scrolls up" such that the newest element is in view?

This topic has been closed for replies.
Best answer by Alexandre RENOUX

Hello,

I guess you encapsulated your List Layout inside a Scrollable Container.

In this setup, you can use moveChildrenRelative() to move the List Layout inside the Scrollable container accordingly.

void ScrollableContainer::moveChildrenRelative(int16_t deltaX, int16_t deltaY)

/Alexandre

2 replies

Alexandre RENOUX
Alexandre RENOUXBest answer
Visitor II
July 15, 2020

Hello,

I guess you encapsulated your List Layout inside a Scrollable Container.

In this setup, you can use moveChildrenRelative() to move the List Layout inside the Scrollable container accordingly.

void ScrollableContainer::moveChildrenRelative(int16_t deltaX, int16_t deltaY)

/Alexandre

RMoha.2
RMoha.2Author
Associate III
July 15, 2020

@Alexandre RENOUX​ 

Thank you so much, with some manipulations and adjustments, that works very well. Appreciated!

RMoha.2
RMoha.2Author
Associate III
July 16, 2020

@Alexandre RENOUX​  My next question would be: For ListLayout, how to implement an equivalent to setWindowSize() in ScollList? I mean, how to implement a way to stop scrolling when reaching the last element of the ListLayout?

(Yes, I have the ListLayout inside a scollable container. )

Alexandre RENOUX
Visitor II
July 20, 2020

Hello,

It's supposed to do it automatically.

I suppose that you are looking at the ListLayout Example because this example has a bug that you can fix by adding the following line at the beginning of void Screen1View::setupScreen() :

void Screen1View::setupScreen()
{
 list.setPosition(0, 0, 0, 0);
 
 // ... The rest of the code
}

/Alexandre

RMoha.2
RMoha.2Author
Associate III
July 21, 2020

That helped, thanks