On-screen keypad (OSK)

Touch-enabled devices include varying sets of physical keys. Some devices include only a few basic keys, while others include a full keyboard. For backwards-compatibility with Canvas-based MIDlets that rely on key input, the touch UI on Symbian devices provides an on-screen keypad (OSK) that simulates the physical keys found on devices without a touch screen. Events from the available keys in the on-screen keypad map the same way as events from physical keys.

Note: Usage of OSK is recommended only for applications which do not handle touch events at all (non-touch MIDlets). It is also recommended that new applications developed for touch devices have their own interaction buttons for usability and visual appearance reasons.

To control the on-screen keypad, use the Nokia-MIDlet-On-Screen-Keypad JAD attribute.

By default, the on-screen keypad behaves as follows:

  • On S60 5th Edition devices, the on-screen keypad is enabled by default for every Canvas-based MIDlet. To disable the on-screen keypad for a MIDlet, use the Nokia-MIDlet-On-Screen-Keypad attribute.

  • From Symbian^3 onwards, the Java Runtime automatically detects the need for the on-screen keypad when a Canvas-based MIDlet is installed, and disables or enables the keypad accordingly for the MIDlet. During installation, the Java Runtime checks if the MIDlet uses any classes that are inherited from javax.microedition.lcdui.Canvas and whether those classes implement any of the following methods:

    • protected void pointerDragged(int x, int y)

    • protected void pointerPressed(int x, int y)

    • protected void pointerReleased(int x, int y)

    If the MIDlet contains at least one Canvas-based class that implements at least one of the above methods, the MIDlet is considered touch-compatible and the on-screen keypad is disabled. If the MIDlet contains Canvas-based classes, but does not implement the above methods, or provides empty implementations of them, the MIDlet is considered touch-incompatible and the on-screen keypad is enabled.

    If you define a valid value for the Nokia-MIDlet-On-Screen-Keypad JAD attribute, the Java Runtime skips automatic detection and enables or disables the on-screen keypad as per the attribute value.

Note: Usage of OSK is recommended only for applications which do not handle touch events at all (non-touch MIDlets). It is also recommended that new applications developed for touch devices have their own interaction buttons for usability and visual appearance reasons.

Touch-enabled devices offer different kinds on-screen keypads for Canvas applications. For more detailed instructions on using on-screen keypads on devices, see the following sections: