Setting Pages API SpecificationChanges in Setting Pages API documentation
Changes in Setting Pages API
Contents
PurposeSetting pages provide a uniform way to present application settings to users on the Symbian platform. This document describes the creation, use, and manipulation of setting lists, setting items and setting pages. API descriptionSetting pages are usually opened from setting items that are in a list form (setting list). Individual application settings are contained in the list as setting items. A setting item is composed of two parts: a label describing the name of the setting, and some form of control that allows the user to view and change the associated application resource. There are several different types of setting items to accommodate different types of application setting management needs. Some of these types allow the user to alter the setting value in place, embedded in the list view; however setting items include separate setting pages for this task. The main benefit of using setting lists for managing application settings is that the setting items are directly bound to variables. Any changes to application settings performed through setting items are immediately reflected in the state of the application and vice versa. This property greatly reduces the complexity of applying changes, and thus allows the application designer to concentrate his or her effort on the actual functionality of the application. Because the number of available settings in an application is constant in one build, setting lists can be easily constructed using only a resource file. The associated resource structures used to create setting lists, setting items, and setting pages are described in this document. Use cases
API class structure
In order to use setting pages in an application, the application must contain
a class derived from the abstract base class
Concrete setting items are implemented by the following classes:
There is a special base class,
Concrete setting pages are implemented by the following classes:
As it can be seen from the lists above, there is no concrete setting item
for the check box, the duration and the radio button setting pages. Either
custom setting item has to be implemented for them (derived from the base
class
Related APIs
Using Setting Pages API
Creating setting lists and items
In order to use setting lists in an application, the application must contain
a class derived from the abstract base class
The declaration of the class
The construction requires initialization of the base class with the resource
of type
Note that
The construction of
The implementation of the method
This method reveals a common pattern used with setting lists: the
The example setting list class described in this chapter has one shortcoming - it does not follow the Model-View-Controller (MVC) design pattern. In the MVC design pattern, the view, the model, and the controller should be separated, and in the example, all of these components are implemented in one class. In a real-world application it is useful to have a separate class for the settings data, and pass an instance of this class to the derived setting list class. Doing so also ensures the proper separation of the user interface and the application engine.
The setting lists are created from resource definitions. The main resource
structure used is
Setting item list resource structure
Setting item resource structure
The identifier and
The setting page associated with a setting item is specified with the
The most important fields in this structure are summarized below. Setting page resource structure
Even though the default resources here for the menu bar and the soft keys
(CBA) are zero, there are defaults provided in the class implementation: the
menubar resource is
Related APIs
Creating and using different setting itemsThere are different setting items available on the Symbian platform. These items, associated resource structures and classes are described in the following sections. Binary switch setting item
The binary switch is the simplest of the setting items: it allows the setting
to be either on or off. Due to its simplicity it is not necessary to open
a setting page to change the value of it: if the Selection key is pressed,
then the value is changed. However, the binary switch setting item has a separate
setting page; the binary value can be changed from there too. The value of
the binary switch setting item is backed up with a Boolean variable of type
The setting item class used with the binary switch type is
Here is an example of a binary switch resource definition:
The corresponding
Related APIs
Text setting item
The text setting item allows users to enter text as the value of the setting.
The value of the setting is stored in a user-specified descriptor. The setting
item class used with the text editor type is
Here is an example of a text editor setting item resource definition:
The corresponding
About proper initialization of the EDWIN resource, see
Related APIs
Enumerated text setting item
The enumerated text setting item gives users a list of options to select
from. It is also possible to enter a text value to the setting item other
than the ones listed; this can be done by selecting “Other” from the pop-up
list. This option is available only if
The setting item class used with enumerated text type is
Here is an example of an enumerated text setting item resource definition:
The corresponding
Related APIs
Alphanumeric password setting itemThe password setting item allows the input of secret data. Password setting items can be either alphanumeric (for passwords) or numeric (see Numeric password setting item ). The setting value is stored in the descriptor supplied on construction of the setting item.
The setting item class used with password type is
Here is an example of an alphanumeric password setting item resource definition:
The corresponding
Related APIs
Numeric password setting itemThe password setting item allows the input of secret data. Password setting items can be either alphanumeric (see Alphanumeric password setting item ) or numeric (for PIN codes). The setting value is stored in the descriptor supplied on construction of the setting item.
The setting item class used with password type is
Here is an example of a numeric password setting item resource definition:
The corresponding
Related APIs
Slider setting item
The slider setting item allows users to specify an integer value. The integer
value has a minimum and maximum value and the control visualization is done
using a slider control. The slider setting item value is stored to the supplied
integer variable of type
The setting item class used with slider type is
Here is an example of a slider setting item resource definition:
The corresponding
Related APIs
Volume setting itemThe volume setting item is similar to the slider setting item because it stores its value in an integer variable. However, the range of the volume control is fixed between 1 and 10. In addition, there is no layout control for the setting page.
The setting item class used with volume control type is
Here is an example of a volume control setting item resource definition:
The corresponding
Related APIs
Time setting item
The time setting item is used with settings with a time value. The associated
variable type with this setting item is
Here is an example of a time setting item resource definition:
The corresponding
Related APIs
Time offset setting item
The time offset setting item is used with settings with a time interval
value. The associated variable type with this setting item is
Here is an example of a time offset setting item resource definition:
The corresponding
Related APIs
Date setting itemThe date setting item is similar to the time setting item, with the obvious exception that it accepts date values. Here is an example of a time setting item resource definition:
The corresponding
Related APIs
IP address setting item
The IP address setting item allows users to manipulate IP address settings.
The variable type associated with this setting item is
The setting item class used with the IP address type is
Here is an example of an IP address setting item resource definition:
The corresponding
Related APIs
Manipulating setting itemsThe setting items have a few properties that can be manipulated at runtime. Editing items from code
When the OK key is pressed, an item is changed or the corresponding setting
page is opened. This behavior can be done from code by calling
Related APIs
Hiding Setting Items
Setting items can be hidden. When a setting item is hidden, it is not shown
on the setting list. This allows the application designer to choose which
items are applicable at a given time depending on the values of other setting
items or application context. Hiding setting items is done by calling the
Hiding setting items may affect the numbering of other items in the setting
list, depending on the presence of the
Related APIs
Defining compulsory indicator
Setting items can be marked as compulsory. The compulsory marking is shown
to the left of the setting item name in the setting list. This indicator can
be altered by setting the
In the following example two items are specified in resource with different compulsory indicator strings.
Related APIs
Defining custom setting items
There is no concrete setting item for example for the check box setting
page. The following example illustrates how to define a custom check box setting
item derived from the base class
Related APIs
Loading and storing setting list and items
Related APIs
Opening setting pages from code
The example code in
Defining custom setting items
also
illustrates how to open a check box setting page from the setting item’s overridden
Related APIs
Observing setting pages
Setting pages can be observed with the help of the
It is important to note that the setting page does not maintain a list of observers - it maintains only one observer reference!
Related APIs
Handling layout changes
In order that derived concrete classes of
Related APIs
Error handlingSetting Pages API uses standard Symbian platform error reporting mechanism and standard error codes. GlossaryAbbreviationsSetting Pages API abbreviations
|