Project

General

Profile

Limiting KeyEvent traffic

Added by Ben Jackson about 12 years ago

I am writing an application that is interested in capturing keyPressed events for a very limited set of keys. (Mostly Key_Up, Key_Down, Key_Right, and Key_Left)

The application also uses mouse dragging events with modifiers, like Shift-Click and Drag and Ctrl-Click and Drag.

During the drag operations, tons of useless keyPressed events are generated for Key_Control and Key_Shift. This seems like a lot of wasted network activity. I was thinking of writing some custom javascript to catch the key presses, discard the ones I'm not interested in and then signal the server application some other way. Is there a better way to go about this? Has it already been done?

Ben


Replies (1)

RE: Limiting KeyEvent traffic - Added by Koen Deforche about 12 years ago

Hey Ben,

Yes, that sounds like the right approach. You should bind a JavaScript function to the event instead, and from within this JavaScript function you can emit a JSignal to communicate to the server.

There is not really a good example of this in the library examples, but this approach is used frequently within the library widget implementations itself.

Regards,

koen

    (1-1/1)