12. Programming
Softkeys of Mobile Phones and the <do> Element
Now
let us introduce to you another useful element in WML -- the <do>
element. The <do> element is used to associate a task to a
certain user interface element of a wireless device. The task will be
done if the user activates the user interface element. The mapping
between a <do> element and a user interface element depends on
the actual wireless device. The WAP specification states that the
user interface element may be a softkey, a function key, a
voice-activated command, etc. In mobile phones, <do> elements
are very often associated to softkeys or items in the options menu
that is brought up by pressing a softkey. To program softkeys of
mobile phones, we need to know how to use the <do> element.
The
<do> element is not difficult to use. Tasks such as <go>,
<prev> and <refresh> are enclosed in the <do></do>
tags. The name attribute of
<do> specifies a unique name to a <do> element. The
label attribute specifies the
label to be displayed on the wireless device's screen (if
applicable). The number of characters in a label should be equal to
or smaller than six if you want it to be displayed nicely on
different types of wireless device. If a label is too long, it may be
truncated on some wireless devices.
The
type attribute of the <do>
element is mandatory. It specifies which type of user interface
element should be associated to a <do> element. Some
commonly used attribute values are accept,
options and prev.
If
the type attribute value is accept,
the <do> element is associated to a user interface element that
can provide a way for the user to accept some kind of action. The
ACCEPT element is usually the left softkey in mobile phone browsers,
since the left softkey is used as the "Yes" or "OK"
softkey typically. The table below gives some descriptions of how
ACCEPT elements are presented on some mobile phone emulators:
Mobile
phone emulators
|
Descriptions
of the ACCEPT element
|
Nokia
Mobile Browser 4.0
|
If
you press the Options softkey on the left, you will see
all the ACCEPT elements.
|
Openwave
Mobile Browser 6.2.2
|
The
first ACCEPT element becomes the left softkey.
If
there are two ACCEPT elements, the second one becomes the right
softkey.
If
there are more than two ACCEPT elements, the right softkey will
be labeled as Menu. You
can see the second to the nth ACCEPT elements if you press
the Menu softkey, where n
is the total number of ACCEPT elements.
|
Sony
Ericsson T610 mobile phone
|
If
you press the More
softkey on the right, the options menu is opened and you can see
all the ACCEPT elements there.
|
Sony
Ericsson T68i mobile phone
|
If
you press the "Options menu" button (located between
the Yes button and the 1 button), the options menu is opened and
you can see all the ACCEPT elements there.
|
If
the type attribute value is options,
the <do> element is associated to a user interface element that
can provide users further options or operations to choose from. Very
often WAP browsers place the OPTIONS elements in an options list and
they provide a certain way for you to bring up the options list, such
as pressing a softkey or a physical button. The table below gives
some descriptions of how OPTIONS elements are presented on some
mobile phone emulators:
Mobile
phone emulators
|
Descriptions
of the OPTIONS element
|
Nokia
Mobile Browser 4.0
|
If
you press the Options softkey on the left, you will see
all the OPTIONS elements. (Presented in the same way as the
ACCEPT element)
|
Openwave
Mobile Browser 6.2.2
|
The
first OPTIONS element becomes the right softkey.
If
there are two or more than two OPTIONS elements, the right
softkey will be labeled as Menu.
You can see the second to the nth OPTIONS elements
if you press the Menu
softkey, where n
is the total number of OPTIONS elements.
|
Sony
Ericsson T610 mobile phone
|
If
you press the More
softkey on the right, the options menu is opened and you can see
all the OPTIONS elements there. (Presented in the same way as the
ACCEPT element)
|
Sony
Ericsson T68i mobile phone
|
If
you press the "Options menu" button (located between
the Yes button and the 1 button), the options menu is opened and
you can see all the OPTIONS elements there. (Presented in the
same way as the ACCEPT element)
|
If
the type attribute value is prev,
the <do> element is associated to a user interface element that
enables users to navigate backwards. The PREV element is usually the
"Back" softkey or physical button of a wireless device. The
table below gives some descriptions of how PREV elements are
presented on some mobile phone emulators:
Mobile
phone emulators
|
Descriptions
of the PREV element
|
Nokia
Mobile Browser 4.0
|
The
first PREV element becomes the right softkey.
If
there are two or more than two PREV elements, you can see the
second to the nth PREV
elements if you press the Options
softkey on the left, where n
is the total number of PREV elements.
|
Openwave
Mobile Browser 6.2.2
|
The
first PREV element becomes the Back button.
If
there are two PREV elements, the second one becomes the right
softkey.
If
there are more than two PREV elements, the right softkey will be
labeled as Menu. You
can see the second to the nth PREV elements if you press
the Menu softkey, where n
is the total number of PREV elements.
|
Sony
Ericsson T610 mobile phone
|
If
you press the More
softkey on the right, the options menu is opened and you can see
all the PREV elements there.
|
Sony
Ericsson T68i mobile phone
|
If
you press the "Options menu" button (located between
the Yes button and the 1 button), the options menu is opened and
you can see all the PREV elements there.
|
Feedback Form ( ExpandCollapse)
|