Skip to content

Latest commit

 

History

History
 
 

WheelSelector

Purpose

Happy new year

The purpose of the WheelSelector (and DatePicker) widgets is to provide an application developer with means of selecting from a number of values by presenting those values in a nice vertical scroller. The application developer supplies a background image for the scroller, the shadow overlay at the top and bottom of the selector and the glass image for the currently selected item in the center of the wheel. Examples of all these images are included. Also, the texts to present in the wheel selector are provided in the texts.xlsx. These images and texts are provided as examples and can be changed to suit the needs for the application.

The widget supports a customizable colors, optional highlighting of selected item with a different color. Some easing equations for animating are hard coded in the WheelSelector class, but can easily be changed to suit the needs of your applications look and feel. The currently selected index can be found by callling getSelectedIndex() and a new index can be assigned using setSelectedIndex() which also allows a customized number of steps and an easing equation to be specified for the transition from the current index to the new index.

TouchGFX Version

This widget was created and tested using TouchGFX version 4.2

Functional description

The following exemplifies, in code, how to set up a WheelSlector widget. Once set up, the selected index of the wheel can be controlled by calling setSelectedIndex().

For an example on how to use a WheelSelector, please refer to the included source code for DatePicker which includes are minimal setup of selecting of month and year from a list of strings. The DatePicker also has a slightly different WheelSelector for day which allows the days 29, 30 and 31 to be dynamically added to the list of legal days depending on which month (and year) is currently selected. These illegal or legal days are faded out/or in for a pleasing effect.