Blackberry 6: how to detect a long click on track

2019-07-21 08:24发布

问题:

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.