Java Reference
In-Depth Information
You might want to add your own implementation of virtual keys that
will be rendered at the sides of the screen to allow the user to interact
via touch.
You may want to consider Nokia's simple solution for MIDlets that use
a Canvas and are not originally made for touch devices. The Nokia-
MIDlet-On-Screen-Keypad proprietary JAD attribute enables
a virtual keypad that generates key events for the canvas-based
MIDlet (see Figure 4.11). The possible values for Nokia-MIDlet-
On-Screen-Keypad are "no" , "gameactions" and "navi-
gationkeys" . Regardless of the value, pointer events still work
normally in the Canvas area.
Figure 4.11 Canvas MIDlet with gameactions virtual keypad
4.6.3 Implementing Device Conventions
If your application supports the touch screen, it should also adhere to
the usage conventions of the device. For example, touching the sides of
the screen may be equivalent to normal usage of the directional keys;
your application should follow this convention and handle touches at
the sides of the screen as pressing on directional keys. Additionally, your
application must not block the conventional mechanism from operating. If
your game extends the LCDUI GameCanvas then it is your responsibility
to ensure the key-press events are not blocked because of the handling
of stylus events. Ensure that your stylus-event-handling methods invoke
the same method of the base class to allow it to handle the stylus events
and translate them to key events, if applicable. Pressing at the side of the
Sony Ericsson W960i screen triggers a key event with a directional code
(left or right). If your application extends the GameCanvas and does not
delegate the stylus events to the same GameCanvas , the key event is not
dispatched by the implementation.
Search WWH ::

Custom Search