beautypg.com

Precedence of assigning commands to a button, Assigning an abstract command type to a button, Example – Sun Microsystems Computer Accessories User Manual

Page 49

background image

Chapter 3

Examining Device Property Files

35

2. Use the definition

command.keys.<

command_type

>

to assign command types to

preferred buttons according to their natural correspondence. See

“Assigning an

Abstract Command Type to a Button” on page 35

3. Use the secondary button assignments to specify alternate buttons for assigning

commands of lower priority. See

“Secondary Button Assignments” on page 36

.

Note –

To achieve an accurate emulation, these assignments need to be made in

accordance with the way the MIDP implementation for the specific device would
make them.

Precedence of Assigning Commands to a Button

In the J2ME Wireless Toolkit, commands are assigned to buttons according to the
following order of preference:

1. Menu operations

2. Abstract command precedence

3. Abstract command priority

First, the menu operations are assigned to the buttons that are defined for them.
Then the abstract commands are assigned. Abstract command precedence is taken
into account before abstract command priority. Thus, if a command of type BACK
with priority 2 and a command of type EXIT with priority 1 are competing for a
button, the BACK command will get the assignment due to its higher precedence.
Command priority is taken into account only when the two commands have the
same type.

Assigning an Abstract Command Type to a Button

You assign an abstract command type to a button using a property definition of the
form:

command.keys.<

type

> = <

button_name

>

where <type> is one of the abstract command types shown in

TABLE 3 on page 33

.

The button name is one of the names listed in

TABLE 2 on page 29

.

Example

If you want to assign command types to the two soft buttons as follows:

Left soft button: command types BACK, EXIT, CANCEL and STOP

Right soft button: command types OK, SCREEN, ITEM, HELP

you would enter the following definitions in the main device property file: