Using the Spinner Control for Selecting Items
When your app needs the user to select an item from a list of choices, use the Spinner control.
Suppose we have a really simple restaurant menu that provides a choice of tacos and drinks. Our customer may select a Chicken, Beef or Vegan taco from an interface that looks like this:
Touching the Chicken Taco item on the screen displays a set of options – select a desired item from the list:
The item labeled “add items…” is a Spinner control, dragged out of the Palette. There are two Spinner controls in this user interface:
Select the first Spinner control and then go to the Properties for that control. In the ElementsFromString item, enter Chicken taco, beef taco, vegan taco. These items, separated by commas, become the elements of the Spinner list.
Do the same for the drinks on the menu:
The code is so simple it hardly needs an explanation! When the user selects an item, the AfterSelecting event occurs. The selected item is obtained from the local variable selection:
Key Features Shown
- Spinner controls are used to select from a list of items
- Add a spinner control in the Designer and set an initial list of items in Properties
- Obtain the selected item with an event handler for the Spinner’s AfterSelecting event.
Please Share on Social Media
Please click on the buttons below this post to share with your friends on Facebook or other social media.
If you are not already following this blog, click on the following links to like on Facebook, add to your Google+ circles or follow on Twitter or in your RSS news reader. Thank you for visiting!