cancel
Showing results for 
Search instead for 
Did you mean: 

scrollListItemSelectedHandler call back function improvement

Taisen
Associate

Hi TouchGFX Team,

I used to directly send email to TouchGFX before the company was merged with STM32. Hope TouchGFX have a wider business!

In the 4.10 update, there is new class scrollList, the item selected was

// The callback updates the selectedIcon bast on the itemSelected parameter
void Screen1View::scrollListItemSelectedHandler(int16_t itemSelected)
{
...
}

This function will be give to callback

void Screen1View::setupScreen()
{
    // The item selected callbacks are registerd with scroll wheel and list
    scrollList.setItemSelectedCallback(scrollListItemSelectedCallback);
...
}

However, the issue is the call back only give a ''int16_t itemSelected'' call back parameter, I some case, I would like to update the ''drawable'', but the feedback is only feedback a itemselected, I could not know how to know which drawable I am working on.

Suggest to have following function:

1, provide a function: getDrawablenumber(int16_t itemNumber), the feedback is the drawable number, so I could use this

	Drawable* d = scrollListListItems.getDrawable(last_selected % numberofDrawble);
	imageContainer* cc = (imageContainer*)d;

to get the imageContainer.

2, the setItemSelectedCallback give two feedback, one is itemselected, another is drawable number.

Here is the effect I am looking for, as you could see, the red background will be updated when I selected the item. I did this using a not very general way, I changed the total item number into 15, and there is only 5 drawable, so, I could use (itemselsected%5) to get which drawable I am using, that means, my item must be 5, 10, 15, 20... ect.

0690X000008wTPRQA2.gif

1 REPLY 1
Martin KJELDSEN
Chief III

Hi @Taisen​,

Thanks for sharing this!

Best regards,

Martin