Controls: SINGLE_CHOICE_DIALOG

What you will learn in this chapter
SINGLE_CHOICE_DIALOG control
Attributes
Reference Tutorials:
Other pickers: CHECKBOX, DATETIMEPICKER, NUMBER_PICKER, RADIOGROUP, SINGLE_CHOICE_PICKER
Reference: Actions, Data Sourcing, appearance

SINGLE_CHOICE_DIALOG control

SINGLE_CHOICE_DIALOG control allows a user to select one of many values. It is essentially a group of radio buttons / values.

The fig on left shows SINGLE_CHOICE_DIALOG control for Android. Same code renders the picker on right in iOS. The look and feel is native to the OS.

../_images/singleshoicedialog_android_tags.png ../_images/singlechoicedialog_iPhone.png

Attributes

Attribute Description / Value Mandatory
type SINGLE_CHOICE_DIALOG Yes
x Defines the starting x position of the control Yes
y Defines the starting x position of the control Yes
width Defines the width of the control Yes
height Defines the height of the control Yes
appearance_name Defines the appearance of the control Yes
field_name Place holder for user input Yes
data_type VARCHAR Yes
title Defines title of SINGLE_CHOICE_DIALOG. For example title=”Shopping list category” Yes
display_values Comma separated values to be displayed in the selection list. For example display_values=”Grocery, Clothes, Stationary” Yes
storage_values Comma separated values to be stored. If provided, the number of storage_values MUST match the number of display values. They give the flexibility to store codes for user selection. No
values_query display_values and storage_values can be fetched from the local database using a query. The first column MUST be display_values. The 2nd column for storage_values is optional. For example values_query=”select * from categories”. No
default_value Default Value is storage_value (if present) or display_value No

Example:

The code below allows the user to select a category:

<control type="SINGLE_CHOICE_DIALOG" x="35" y="14" width="40" height="8" appearance_name="grey_button" data_type="VARCHAR"
                 field_name="category" default_value="Select Category" title="Shopping List Category"
                 display_values="Grocery, Office Supplies" storage_values="Grocery, Office Supplies"/>

Reference tutorial

This chapter uses source code from appemble-tutorial-single-sel-ctrl. If you have not downloaded tutorial source code, click on Download Source Code - Tutorials

Android - Right click on appemble-tutorial-single-sel-ctrl and click on Run as Android application.

iOS - Select scheme appemble-tutorial-single-sel-ctrl and iPhone/iPad x.x simulator. Click on Product -> Run.