cancel
Showing results for 
Search instead for 
Did you mean: 

Incrementing The TouchGFX ScrollWheel

Al-E-Bags
Senior

Hi all.  I am looking for the correct method with which to implement a custom scroll wheel display.  By default the display of numeric characters starts at '0' and increments by a single digit ad infinitum.  For example and if possible, I would want to display the values 400 -> 1100 incrementing in steps of 100 however, I see no easy method within TouchGFX to be able to achieve this.  I may be missing something, I usually do.  If this is possible from within TGFX, can someone please advise how to manage this.  If not, then please advise an alternative user code method or function to achieve it.   Your help is much appreciated.    

Screenshot 2024-11-27 141118.png

2 REPLIES 2
LouisB
ST Employee

Hello @Al-E-Bags,

You can refer to Tutorial 4: Creating a Scroll Wheel with Custom Behavior | TouchGFX Documentation, it explains how to use a scroll wheel, but instead of :

virtual void scrollWheelUpdateItem(MenuElement& item, int16_t itemIndex)
{
item.setNumber(itemIndex);
}

 

Add an offset and limit the number of items in designer to the one desired :

virtual void scrollWheelUpdateItem(MenuElement& item, int16_t itemIndex)
{
item.setNumber(400+itemIndex*100);
}

 

Best regards,

Louis BOUDO
ST Software Developer | TouchGFX
Al-E-Bags
Senior

Hi @LouisB and thanks for your suggestion. I'll be studying the tutorial over the next day or two.  I will let you know how I progress.