Blackberry 6: how to detect a long click on track pad?

和自甴很熟 提交于 2019-12-11 04:05:45

问题


how do you detect a long click on a track pad please? I.e. on this thingy:

I can detect a short click with:

public boolean navigationClick(int status, int time) {
    // XXX
    return super.navigationClick(status, time); 
}

And also I can detect a long click on a touch screen with:

protected boolean touchEvent(TouchEvent event) {
    if (event.getEvent() == TouchEvent.GESTURE) {
        TouchGesture gesture = event.getGesture();
        if (gesture.getEvent() == TouchGesture.HOVER) {
            // XXX
            return true;
        }
    }
    return super.touchEvent(event);
}

But I just can't find how to detect the long click on a track pad (I'd like to show a popup menu in that case)...

Thank you! Alex


回答1:


I would play with trackwheelClick(int status, int time) and trackwheelUnclick(int status, int time) to determine click length. You'll have to set flags here and there (probably in navigationClick() as well) to not fire normal click events prematurely. Beyond that, I don't know of a LONG_CLICK flag or anything.



来源:https://stackoverflow.com/questions/6141280/blackberry-6-how-to-detect-a-long-click-on-track-pad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!