Resources | Resources |



Touchscreen support

When an application is touch-enabled, widgets handle touchscreen events.

To enable touchscreen support, the application creates the root form or root container, then calls IWidget_EnableTouch() on the root form or container, which sends the EVT_WDG_ENABLETOUCH event. When the root form or container receives the EVT_WDG_ENABLETOUCH event, it creates the Touch Observer, and forwards the event to its children, which causes the widgets to instantiate their Touch Controllers. All touch-enabled widgets have a Touch Controller that handles touch events. Widgets that are later attached to a touch-enabled parent will be touch-enabled.

When the root container or form processes events, it first sends all received touch events to the Touch Observer, which collects and analyzes event information. The root form or container also determines which widget should receive the event, based on the location information (contained in the event). If the receiving widget is also a container, it will similarly use the location information to determine which child widget should receive the event. When the intended target widget receives the event, it sends the event to its Touch Controller, which determines the action to be taken.

Note: An application that is touch-enabled may also need to allow navigation using keys. For more information, see Enabling navigation using the keypad.

Touch observer

The Touch Observer analyzes and collects information about touch events passed to it from the root container or root form. Controllers and applications can query the Touch Observer for various properties that are recorded or derived, such as magnitude and angle of the movement, initial velocity, pointer up or pointer down information, and linear movement deviation. For more information, see Touch observer.

Widget touch support

A widget's touch support is a read-only property that specifies the type of pointer events it is prepared to receive. It can be one of the following:

  • AEEWIDGET_TOUCH_SUPPORT_SINGLE_POINTER - The widget only supports single pointer events. It can only handle pointer events describing pointer 1.
  • AEEWIDGET_TOUCH_SUPPORT_MULTIPLE_POINTERS - The widget supports pointer events describing multiple pointers at a time.

Note: This is not configurable at runtime. This property is only important for a developer who wants to create a Custom widget which supports multiple pointers.

Touch mode

The touch mode of a widget determines whether events are passed through the widget to a widget below. It is a settable property. The following touch mode properties are supported:

  • AEEWIDGET_TOUCH_MODE_ALWAYS indicates the widget always takes touch events.
  • AEEWIDGET_TOUCH_MODE_NEVER indicates the widget does not take touch events.
  • AEEWIDGET_TOUCH_MODE_TRANSPARENCY indicates the widget may take a touch event depending on the transparency value at the given coordinate.
  • AEEWIDGET_TOUCH_MODE_BORDER is a variation of AEEWIDGET_TOUCH_MODE_TRANSPARENCY. Only the border checks for transparency. The widget content is considered opaque.
  • AEEWIDGET_TOUCH_MODE_CHILD indicates that only a child widget can take touch events, depending on the child widget's touch mode. Touch events on a coordinate that does not have a child widget will never be handled.

Flick support

When a flick occurs, the root form or root container passes the event to the widget's Touch Controller. Based on the touch event and information from the Touch Observer, the Touch Controller controls the scrolling of the widget.

Currently, the list widget, list container, and viewport widget support scrolling. Applications should set LWF_PIXELSCROLL and LWF_LIVESCROLLto allow widgets to support live scrolling and pixel scrolling. Specifying LWF_PIXELSCROLL allows scrolling to occur one pixel at a time, instead of one item at a time. LWF_LIVESCROLL allows scrolling to occur when an item is selected and moved.

Note: The viewport widget only supports LWF_PIXELSCROLL.

For more information, see Creating a flickable list widget.