Working with Embedded Wizard: Handling touchscreen or mouse events

With the Touch Handlers the Mosaic framework provides objects to react to touchscreen events and recognize gestures. For this purpose, you arrange the desired Touch Handler within an area of a GUI component where you want it to respond to user touchscreen interactions. Later, at the runtime when the user touches inside this area, the Handler reacts to it, eventually preprocesses the event and sends signals to slot methods associated with the Handler. Within the slot method, you can execute your particular code to handle the interaction.

Although we speak here generally about Touch Handler, every Handler can react also to events generated by an ordinary mouse device. In other words, if you develop an application for a product controlled by a mouse, you use the Touch Handler to process the mouse events in the similar manner as touchscreen events are processed.

The following table provides an overview of all available Touch Handlers, so that knowing this you will be able to decide by yourself which Handler is the most suitable for your particular application case. More detailed description of the Handlers is found in the subordinated chapters:

Icon

Handler type

Description

Simple

This Touch Handler is intended to process raw touchscreen events. With this Handler you can react to simple taps or even implement sophisticated gesture recognizer.

Wipe

This Touch Handler is optimized to detect one finger wipe gestures. When the user touches the screen and drags the finger vertically or horizontally, the Touch Handler recognizes the movement. In particular, the Handler can distinguish between a wipe up, down, left and right gesture.

Rotate

This Touch Handler is optimized to detect one finger rotate gestures. When the user touches the screen and drags the finger, the Touch Handler calculates from the movement the rotation angle around the center of its area. As such, this Handler is ideal to implement any kinds of wheel and rotary knob widgets.

Slide

This Touch Handler is optimized to detect one finger slide gestures. Each time, the user strokes the screen inside the Touch Handler's area, the Handler adjusts the scroll offset of the associated content according to the direction, distance and speed of the user's finger movement. As such, the Slide Touch Handler is ideal to implement applications permitting the user to intuitionally scroll long text blocks, large images or lists containing thousands of items.