Event-handling model

The mobile OS event-handling model is significantly different from the one in PowerBuilder. Instead of delivering mouse and keyboard events, mobile OS delivers touch and gesture events. Therefore, the PB mouse and keyboard events will be mapped to the mobile touch and gesture events automatically at runtime, for example, the click event in PB is interpreted as the tap event in mobile OS, the double-click event in PB is interpreted as the tap-twice event in mobile OS. But not all of the PB mouse and keyboard events can be directly mapped to a mobile event, for example, the MouseMove event and the keyboard events (KeyDown and KeyUp) have no counterpart mobile events, you will need to understand how these events will be supported by PowerServer Mobile first, if you want to take advantage of these PB events to achieve what you want on the mobile device.

Some events such as right-click etc. are less natural in the mobile device and some events such as LButtonDown for the Drag event conflict with scrolling, therefore, these events should not be used. However, to keep compatible with the existing application logic, if these events are used, they will be preserved and triggered by using a special tool provided by PowerServer Mobile called Assistive Touch Bar, as shown below.

By default, the Assistive Touch Bar is hidden on the titlebar. To display it on the titlebar, you can call the of_setassistivetouchbtnvisible API. For details, please see the section called “of_setassistivetouchbtnvisible” in Workarounds & APIs Guide.

Figure 1. Assistive Touch Bar

Assistive Touch Bar

The Assistive Touch Bar contains three modes (only one can be turned on, by default Left-Click mode is turned on):

  • When Left-Click mode is turned on, if the finger touches down and moves within 500 milliseconds, scrolling takes place; if the finger touches down and then moves after 500 milliseconds, then either dragging takes place if drag(begin!) is called, or scrolling takes place; if the finger touches down and then lifts up without moving, the normal event sequence will be triggered. If you want dragging to take place without needing to hold for 500 milliseconds, you can turn on the Drag mode.

  • When Right-Click mode is turned on, events will be triggered in the following order: when the finger touches down, RButtonDown is triggered, when the finger touches down and then moves, MouseMove is triggered, when the finger lifts up, RButtonUp is triggered.

  • When Drag mode is turned on, dragging takes place immediately when the finger touches down a control and moves. Unlike the Left-Click mode, you do not need to hold for 500 milliseconds for dragging to take effect.