Sun Microsystems Computer Accessories manual Precedence of Assigning Commands to a Button

Page 49

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:

Chapter 3 Examining Device Property Files 35

Image 49
Contents Basic Customization Guide Please Contents Examining Device Property Files Default Emulator Device Property Files Vi Wireless Toolkit Basic Customization Guide December Figures Viii Wireless Toolkit Basic Customization Guide December Tables Wireless Toolkit Basic Customization Guide December How This Book Is Organized Who Should Use This BookUsing Operating System Commands Shell Prompts Typographic ConventionsRelated Documentation Sun Welcomes Your Comments Accessing Sun Documentation OnlineHow to Customize the Wireless Toolkit Customizing the Wireless ToolkitCustomization Steps Device Property Files and the Default EmulatorCustomizing the Wireless Toolkit Wireless Toolkit Basic Customization Guide December Make a Copy of an Existing Main Device Property File Creating Device Property FilesObtain and Enter Image Files Screen Location Obtain and Enter the Screen PropertiesDisplay Area Total Screen SizeSpecifying Screen Properties Display Area in Full Screen ModeBy measuring the image file, obtain the button properties Obtain and Enter the Button PropertiesHeight Width Obtain and Enter Soft Button Label Areas Soft button label display is defined by a line of the form Defining the Icon Location and States Obtain and Enter Icon PropertiesEnter the following measured values for the icons properties Run the Emulator for the New Device Enter Color PropertiesScreen Background RGB Color Examining Device Property Files Device Property Files Fonts Main Device Property FileFonts Used by the Midp APIs System Fonts Default FontBitmap Fonts Ascii character Distance to character Device Image Font UnderliningImage with Buttons Pressed Image without Buttons PressedImage with Buttons Highlighted and Backlight On ScalingScreen Properties Screen Location Total Screen Size Display Area in Full Screen ModeDisplay Area Screen Background Color Screen Pixel RatioTouch Screen Screen Border ColorScreen Buffering Keyboard Handler Device ButtonsDefining a Device Button Button.LEFT = 13, 197, 20 Assigning a PC Keyboard Key to a Button Specifying the Characters Generated by a Button Press Assigning a Game Action to a ButtonAbstract Command Types in Order of Precedence Assigning Abstract Commands to ButtonsEmulating Abstract Command Button Assignments Precedence of Assigning Commands to a Button Secondary Button Assignments Abstract Command Menu Defining the Icon Location and States Displayed IconsSoft Button Labels on the Emulated Device Display Soft Button Label DisplaySound Alerts ColorAlert Type Values Device Software CapabilitiesCharacter Encodings LocalesTransparent Images EnableAlphaChannel falseWireless Toolkit Basic Customization Guide December Property Files Default Emulator Device Property FilesDefaultGrayPhone.properties Appendix a Default Emulator Device Property Files Wireless Toolkit Basic Customization Guide December Appendix a Default Emulator Device Property Files Wireless Toolkit Basic Customization Guide December # alert.alerttype.sound soundfile Wireless Toolkit Basic Customization Guide December Icon Image Files Device Image FilesIcon Image Files Adding a ByteCode Obfuscator Support for ByteCode ObfuscatorsExample Appendix B Support for ByteCode Obfuscators Wireless Toolkit Basic Customization Guide December P E N D I X C Wireless Toolkit Basic Customization Guide December Index Keyboard.handler property Device property files, 1 WMA messages, customizing Wireless Toolkit Basic Customization Guide December