Scroll in blackberry no-touch

I’m developing my application in blackberry, compiling with the phonegap framework, but I found a problem, in non-touch blackberrys (Curve 9300) is impossible to scroll a list (happens via browser too), are there any way to do this scroll via framework or javascript? If a sample is needed I can provide.
thank you so much

Hey vige. I know you’re probably looking for an official DHTMLX answer to this, but since I just recently happened upon this problem in my own development, I figure I would lend you a hand.

What you can do is create two variables for x and y position of the cursor, and a function that fires everytime your cursor moves in your browser like so:

[code]
var posX;
var posY;

document.onmousemove = function(e){
posX = e.pageX;
posY = e.pageY;
}[/code]

After you have those set, write a js setInterval function that will call your scrolling function, ie.

setInterval("scrollSomething()", 500);

This sets the scrollSomething function to be called every 500ms.

Finally, create your scrollSomething function and inside of it do a check. If the cursor is at the top/bottom of your screen, perform a scrollTo on your component, increasing/decreasing the Y value by a set amount. This gives an intuitive feeling to your scroll function. Scroll to the top, the view goes up, scroll to the bottom, down she goes!

Hint: You can get the current Y position of your component by using scrollState(). I personally have not been able to get it working with PageList (at least in the X direction) but it works just fine with Scrollviews.

Hope this helps.

Try to add after including touchui.js on the page the next two lines

dhx.env.mobile = true; dhx.env.touch = true;

It will force usage of touch scroll.

Thanks for the answers, I tryied both solutions and none worked, The first I think I’m doing something wrong, would be too much to ask for a sample? please? I will be eternally grateful

Stanislav, That dont worked, I think you missunderstand me, I dont want touch support, I want to scroll a list with a trackball

Thanks again to both of you

Two above flags must enable touch scroll support for any device - it may help if touch support was not detected for the device.

I want to scroll a list with a trackball
Such action will be equal to mouse-wheel-scrolling?
I’m not sure which events trackball will fire for html page. Framework was designed for touch devices, so it has not native support for mouse-wheel and similar events.

Next may work

var some = $$("mycomponent"); dhx.event(some.$view, "mousewheel", function(e){ var dir = e.wheelDelta*-1; some.scrollTo(some.scrollState().y+dir); });

Finally I get it!!! I used jdrharding’s way and it works really fine, I write my method in cause someone need it

document.onmousemove = function(e){ posX = e.pageX; posY = e.pageY; } setInterval("scroll()", 500);

function scroll(){
if (posY>0 && posY<5){//scroll arriba
$$(“lista”).scrollTo(0,-100);
//alert (“scroll top”);
}
if (posY>210 && posX<215){//scroll abajo
//alert (“scroll bot”);
$$(“lista”).scrollTo(0,100);

}

}

being “List” the list that I want to scroll

Thanks to all

That is very very funny, I was just about to post a reply stating that my method was working for every type of BlackBerry.

I’m glad it’s working Vige, good luck to you in the rest of your development.

Thank you for this fix! I’m using it on a FormPanel, works good.

I needed one change. My FormPanel is wrapped in a TabPanel, so the scroll area is not the bottom of the screen (it’s about 50px up)

  • This line:

if (evt.xy[1] > 300 && ...

  • Changed to:

var bottom = scrollList.getHeight() - 15; if (evt.xy[1] > bottom && ...

Hey thank you for this great information. I am very much grateful to you. It will help me a lot for my further process.