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
geoffre
Posts: 37
Registered: ‎03-12-2009
My Device: Not Specified

How to manage Storm touch screen

Hi,

 

I would like to manage with my javascript widget the touch screen on a blackberry storm.

Especially the drag movements from left to right and right to left on the screen.

 

I try to use "onmousemove" to detect direction of the finger movement, I also associate this event with

"onmousedown" and "onmouseup" events to differentiate click to touch.

 

This doesn't run in the simulator (Storm 2 9550 (5.0.0.469)), it seems that when using the right mouse button to simulate touch screen (not click) no mouse events are raised.

 

Does it exist an another mean to manage the screen touch for a Storm device ?

Please use plain text.
Developer
geoffre
Posts: 37
Registered: ‎03-12-2009
My Device: Not Specified

Re: How to manage Storm touch screen

See below the code I use to manage the touch screen detection :

 

 

var __originX = -1;
var __dir = 0;
var __onSel = null;


function mouseMove(e){
    var relTarg = e.relatedTarget || e.fromElement;
    if(__originX != -1){
        if (e.pageX > __originX) __dir = 2;
        else __dir = 1;
    }
}

function mousePress(e){
    var relTarg = e.relatedTarget || e.fromElement;
    __onSel = relTarg;
    __originX = e.pageX;
}

function mouseRelease(e){
    var relTarg = e.relatedTarget || e.fromElement;
    if(__onSel === relTarg){
        if(__originX == e.pageX){
            clickElem();
        }else{
            dragElem();
        }
    }
}

function dragElem(){
    alert("DRAG TOUCH ....");
}

function clickElem(){
    alert("CLICK ....");
}


 

---

 

 

Where:

 

            __myElem.onmousedown = mousePress;
            __myElem.onmouseup = mouseRelease;
            __myElem.onmousemove = mouseMove;

 

Please use plain text.
Contributor
cgishack
Posts: 12
Registered: ‎03-20-2011
My Device: 9800

Re: How to manage Storm touch screen

I am trying to do the same, but the onmousemove event is not firing on the Storm (5.0.0.517) simulator.

I tryied the right click , left click, multi touch.

 

my code is similar to the below

myElement.onmousemove = function(e) { alert('test mouse move');  }

 

How do i get touch events on the Storm to work?

Please use plain text.