Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
onelord2002
Posts: 66
Registered: ‎09-14-2011
My Device: Simulator
My Carrier: Developer
Accepted Solution

Touch vsTrackball

I'm writting an app that support both touch and trackball navigation.

so i'm using setFocus(elementId) where ever needed and it is working fine on touch emulators

but my client is using

 

BlackBerry 9530
Smartphone (3G, CDMA)
V4.7.0.148 (Platform 4.0.0.181)
BlackBerry 9530. V4.7.0.148 upgraded to  v5.0.0.328

where ever i'm calling setFocus() app stops working

so is there any way to check if the mobile support touch so that i can do something similar to this

 

if(isTouchEnabled){
   setFocus(elementId);
}

 

 

Please use plain text.
Developer
onelord2002
Posts: 66
Registered: ‎09-14-2011
My Device: Simulator
My Carrier: Developer

Re: Touch vsTrackball

i solved it myself

 

read somewhere that resolutions are different for both touch and trackball enabled devices

so i used wikipedia and prepared list of all the resolutions of devices that support only touch

 

List_of_BlackBerry_products

 

the list is as follows

 

"360x480",
"480x640",
"480x800",
"640x480"

 

using this data i wrote a javascript as follows

 

//--- List of all resolutions that support touch ---
var touchSupportedResolutionList = [
                                    "360x480",
                                    "480x640",
                                    "480x800",
                                    "640x480"
                                    ];

// return true if the device is touch enabled else false function isTouchEnabled(){ var height = screen.height; var width = screen.width; var resolution = screen.width+"x"+screen.height; for(var i=0 ; i<touchSupportedResolutionList.length ; i++){ if(touchSupportedResolutionList[i] == resolution) return true; } return false; }

 

 

Please use plain text.