Change browser behavior using ‘ClientSettings’

ClientSettings is an additional interface variable for Thinfinity VirtualUI LibraryIn our last post we started with a new notes and tips series aimed at helping developers take full advantage of Thinfinity® VirtualUI™’s existing possibilities.

In the present note, we will focus on ClientSettings.

ClientSettings is an additional interface available at the Thinfinity VirtualUI Library that allows developers to remotely and programmatically configure particular browser settings. These settings are related to the cursor visibility and some specific touch action behaviors.

We can find, in the table below, a detailed explanation of the ClientSettings interface’s current properties:

 

Property Use Values
CursorVisible It used to set show or hide the mouse pointer. True / False
MouseMoveGestureStyle It defines whether the mouse movement is readed as relative or as absolute, in touch devices. MM_STYLE_RELATIVE = 0MM_STYLE_ABSOLUTE = 1
MouseMoveGestureAction It indicates if the drag should be interpreted as a 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, as previously mentioned, were created to provide a better end-user experience when using touch devices.

When using a touch device, it is unusual for a mouse pointer to be displayed. Instead, finger gestures are interpreted by the device as different commands, acting on the element or elements that are located where the gesture is made.

But this is not always the best way, especially when our applications were not designed for these gestures. Oftentimes, the best solution to this issue is to show the pointer and simulate the mouse actions from the gestures captured.

The properties that we have presented above will help us 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 or mobile device, and if detected, to change the pointer behavior. (Be careful! The detection list is incomplete):

 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 aimed at providing 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.

Leave a Reply

Your email address will not be published. Required fields are marked *