eSWT components in touch interaction

eSWT components use the predefined touch implementation provided by the device, so you do not need to separately program touch interaction for them. The device platform defines how these components look and behave.

Handling touch events for Controls

For Controls, you can implement custom touch functionality on top of the default functionality by receiving and handling mouse events. Symbian devices support the following mouse event methods for notifying about touch events:

For more information about the different event combinations that make up touch actions, see table Basic touch actions.

To implement custom touch functionality for a Control:

  1. Use the Screen.isTouchScreen method to check whether the device supports touch events. The method returns true if the device has a touch screen.

  2. Implement the necessary mouse event listeners and methods:

    Handle the touch events directly in the mouse event methods, or use the methods to call separately defined event handlers.

  3. Register the listeners for the Control:

Selection events

The following eSWT components send a widgetDefaultSelected event when selected:

On S60 5th Edition devices, a component is selected when it is tapped while focused. From Symbian^3 onwards, a component is selected with a single tap. The widgetDefaultSelected event is sent at the end of the activating tap when touch is released.

The above components also send a widgetSelected event on the first tap if the selected item has changed. The widgetSelected event is sent when the screen is touched.

Commands and Menus

On S60 5th Edition devices, Commands and Menus attached to a Control, including those of any parent Composite, are shown in the Options menu when the Control is focused.

From Symbian^3 onwards, Commands and Menus attached to a Control are shown in a pop-up menu, which is opened by long-tapping the Control. The pop-up menu does not contain the Commands and Menus of any parent Composite. This means that Commands and Menus attached to a Composite are inaccessible if the Composite area in the UI is fully covered by child Controls. (The Composite pop-up menu cannot be long-tapped, since it is hidden under the child Controls.)

Note: Use Control-specific Commands and Menus sparingly, since they can be hard to find with long taps.

Commands and Menus attached to Shells are shown in the Options menu.