cancel
Showing results for 
Search instead for 
Did you mean: 

Elements in ListLayout view

RMoha.2
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions
Alexandre RENOUX
Principal

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

View solution in original post

5 REPLIES 5
Alexandre RENOUX
Principal

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

@Alexandre RENOUX​ 

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

RMoha.2
Associate II

@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. )

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

That helped, thanks