TouchGFX ScrollList with a variable number of items
Hello,
I am new in TouchGFX and I like it. But now I have a problem:
I am trying to make a ScrollList with a variable number of items. To do that, I made in TouchGFX a ScrolList with number of items: 1 and a height of 50 which is the height of 1 item. The generated code is
scrollList1.setPosition(40, 200, 400, 50);
scrollList1.setHorizontal(false);
scrollList1.setCircular(false);
scrollList1.setEasingEquation(touchgfx::EasingEquations::backEaseOut);
scrollList1.setSwipeAcceleration(10);
scrollList1.setDragAcceleration(10);
scrollList1.setNumberOfItems(1);
scrollList1.setPadding(0, 0);
scrollList1.setSnapping(false);
scrollList1.setOvershootPercentage(75);
scrollList1.setDrawableSize(50, 0);
scrollList1.setDrawables(scrollList1ListItems, updateItemCallback);
add(scrollList1);
In the setUpScreen(), I change the following
void Screen4View::setupScreen()
{
uint16_t elements;
uint16_t height;
uint16_t windowsize;
elements = presenter->NofThick(); // Number of elements
if(elements < 5) windowsize = elements; // when < 5 elements, all elements should be visible at same time
else windowsize = 5; // max 5 elements should be visible
height = elements * 50; // height number of elements * 50 => height of one element
if (height > 250) height = 250; // calculate height of the widget
scrollList1.setPosition(40, 200, 400, height);
scrollList1.setWindowSize(windowsize);
scrollList1.setNumberOfItems(elements);
scrollList1.invalidate();
Screen4ViewBase::setupScreen();
}
When elements is 1, then ScrollList show 1 element, that's right.
When elements is 2, then the ScrollList show 2 elements, that's right.
When elements is 3 or more, the ScrollList shows 2 elements. I can select the other elements by scrolling through the list, but the ScrollList shows only maximal 2 elements at the same time. What must I change to see more then 2 elements?
