Sun Microsystems Computer Accessories manual Assigning Abstract Commands to Buttons

Page 47

There are two ways you can do a button press at the same time as pressing Shift or Alt:

Map the buttons to the keyboard, as in the previous section, and press the key associated with the button at the same time as the Shift or Alt keys

Press the button Shift-Lock or Alt-Lock and then do the button press. Press Shift-Lock or Alt-Lock again to revert to the initial state.

For example:

keyboard.handler.qwerty.A = 'a' 'A' '?'

Assigning Abstract Commands to Buttons

Abstract commands are provided in the MIDP specification in order to allow an application to issue a screen command without having to take into account how the user selects that command on a specific device—making the application more portable. The idea is to separate the semantics of the command from its execution on the device. The semantics are defined in the application and the execution is defined in the implementation of MIDP on the specific device.

The semantics of an abstract command include:

Label—the command name for display purposes

Type—the category of the command, for example BACK or HELP. The command type is used to help determine how a command is mapped onto a device

Priority—a priority number. The command priority is used to help determine how a command is mapped onto a device.

In the MIDP Reference Implementation, which underlies the J2ME Wireless Toolkit, there is an implicit order of precedence among the command types. This command precedence also impacts on the assignment of a command to a preferred button. If two commands of different types are vying for the same button, the command whose type has higher precedence prevails.

TABLE 3 shows the abstract command types in order of precedence in the J2ME Wireless Toolkit and the MIDP Reference Implementation:

TABLE 3 Abstract Command Types in Order of Precedence

Command Type

Description

 

 

BACK

Returns the user to the logically previous screen

EXIT

Exits from the application

CANCEL

Standard negative answer to a dialog implemented by the

 

current screen

STOP

Stop some currently running process or operation

 

 

Chapter 3 Examining Device Property Files 33

Image 47
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 Related Documentation Typographic ConventionsShell Prompts 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 Screen Background RGB Color Enter Color PropertiesRun the Emulator for the New Device Examining Device Property Files Device Property Files Fonts Used by the Midp APIs Main Device Property FileFonts Bitmap Fonts Default FontSystem Fonts Ascii character Distance to character Device Image Font UnderliningScaling Image without Buttons PressedImage with Buttons Pressed Image with Buttons Highlighted and Backlight OnScreen Properties Screen Location Display Area Display Area in Full Screen ModeTotal Screen Size Screen Background Color Screen Pixel RatioScreen Buffering Screen Border ColorTouch Screen Defining a Device Button Device ButtonsKeyboard Handler 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