2020-11-16 04:14 AM
I use on screen scrolllist and in base.hpp have
touchgfx::DrawableListItems<MenuItem, 7> scrollList1ListItems;
Where number 7 i cant change and when menu have 8 or more lines app crash.
I make more diagnostic and locate, that TouchGFX can show and scroll by touch or in simu mouse any number of items, but when my user function try call method to customcontainer app crash.
This is function for move cursor down:
void Screen4View::curdown()
{
scrollList1ListItems[cursorpos].selit(0);
if (cursorpos < scrollList1.getNumberOfItems()-1)
{
cursorpos++;
}
else cursorpos=0;
//here crash
scrollList1ListItems[cursorpos].selit(1);
scrollList1.animateToItem(cursorpos,14);
scrollList1.invalidate();
}
crash on marked line when cursorpos > 6
Help.
Solved! Go to Solution.
2020-11-16 10:57 AM
I solve it add bool protected sel and use
void Screen4View::curdown()
{
sel=false;
scrollList1.itemChanged(cursorpos);
if (cursorpos < scrollList1.getNumberOfItems()-1)
{
cursorpos++;
}
else cursorpos=0;
sel=true;
scrollList1.itemChanged(cursorpos);
scrollList1.animateToItem(cursorpos,14);
scrollList1.invalidate();
}
then call selit in Screen4View::scrollList1UpdateItem
TouchGFX use on runtime only limited count of containers based on size list/container + 2 for my screen 7.
2020-11-16 04:54 AM
@Martin KJELDSEN i mean this is similar question as unreplied here https://community.st.com/s/question/0D50X0000Amj9wt/scroll-list-addremove
Designer generate non editable base code and screen need in setup part add elements to array scrollList1ListItems. But i dont know how. Please example.
2020-11-16 10:57 AM
I solve it add bool protected sel and use
void Screen4View::curdown()
{
sel=false;
scrollList1.itemChanged(cursorpos);
if (cursorpos < scrollList1.getNumberOfItems()-1)
{
cursorpos++;
}
else cursorpos=0;
sel=true;
scrollList1.itemChanged(cursorpos);
scrollList1.animateToItem(cursorpos,14);
scrollList1.invalidate();
}
then call selit in Screen4View::scrollList1UpdateItem
TouchGFX use on runtime only limited count of containers based on size list/container + 2 for my screen 7.
2020-11-17 05:38 AM
Hi @MM..1 ,
I'll look into this. You're probably right.
/Martin
2020-11-17 05:46 AM
Actually - "7" is just the number of visible elements in the list =) It does not make sense to update something that cannot be seen.
Try reducing the size of your list view and see that the generated code changes. And the list view has callbacks for when you're scrolling a new item into view (from top or bottom) so you can place an item at the bottom if that item is about to be scrolled into view. It's an optimization. I think you'll be able to find it in the documentation support.touchgfx.com