In our last post, we started with a new “notes and tips” series aimed at helping developers take full advantage of Thinfinity VirtualU’s existing possibilities.
In the present note, we will focus on ClientSettings.
ClientSettings is an additional interface available at the Thinfinity VirtualUI Library. It allows developers to remotely and programmatically configure particular browser settings. These settings are related to the cursor visibility and some specific touch action behaviors.
The properties
This table shows a detailed explanation of the ClientSettings interface’s current properties:
Property | Use | Values |
CursorVisible | It is used to set show or hide the mouse pointer. | True / False |
MouseMoveGestureStyle | It defines whether the mouse movement is read as relative or as absolute, in touch devices. | MM_STYLE_RELATIVE = 0MM_STYLE_ABSOLUTE = 1 |
MouseMoveGestureAction | It indicates if the drug should be interpreted as scrolling or as a turn of the mouse wheel, causing a shift-only item on which the action is triggered. | MM_ACTION_MOVE = 0,MM_ACTION_WHEEL = 1 |
These properties were created to provide a better end-user experience for mobile users.
When using a mobile or other touch device, it is unusual for a mouse pointer to be displayed. Instead, the device will interpret finger gestures as different commands, acting on the element or elements that are located where the gesture is made.
As our applications were designed to run on Windows desktop and resolve mouse movements, this device behavior can be tricky. Oftentimes, the best solution to this issue is to show the pointer and simulate the mouse actions from the gestures captured.
THE SOLUTION PROPOSED
The properties that we have presented above will help us to define the ideal settings to enjoy the best possible and intuitive user experience for our application.
The following example shows how to recognize a touch device or mobile device, and if detected, to change the pointer behavior.
The following list is not complete, but it will give you an idea:
vui = new VirtualUI();
userAgent = vui.BrowserInfo.UserAgent.ToLower();
if ((userAgent.IndexOf("touch") != -1) || (userAgent.IndexOf("mobile") != -1) ||
(userAgent.IndexOf("iphone") != -1) || (userAgent.IndexOf("ipod") != -1) ||
(userAgent.IndexOf("ipad") != -1) || (userAgent.IndexOf("android") != -1) ||
(userAgent.IndexOf(" cros ") != -1)) {
vui.ClientSettings.MouseMoveGestureStyle = MouseMoveGestureStyle.MM_STYLE_ABSOLUTE;
vui.ClientSettings.MouseMoveGestureAction = MouseMoveGestureAction.MM_ACTION_WHEEL;
}
This would be the end of this week’s small technical note. We wanted to provide a simple tip to help you take advantage of the features added to your applications through the adoption of Thinfinity VirtualUI.
We invite you again to share with us your concerns and/or experiences.