cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX list items limited to 7. Howto extend?

MM..1
Chief III

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.0693W000005BV9aQAG.png

1 ACCEPTED SOLUTION

Accepted Solutions
MM..1
Chief III

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.

View solution in original post

4 REPLIES 4
MM..1
Chief III

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

MM..1
Chief III

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.

Martin KJELDSEN
Chief III

Hi @MM..1​ ,

I'll look into this. You're probably right.

/Martin

Martin KJELDSEN
Chief III

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