PDA

View Full Version : KeyHandlers



FrankValcarcel
6-May-2014, 01:56 PM
How much overhead to key handlers add? The question is whether adding key handlers at the class level will degrade performance?

Harm Wibier
6-May-2014, 04:07 PM
Do you mean the overhead in registering them or the overhead of them firing? Adding a key handler in the OnLoad will cause a client-action to be performed increasing the size of the response. This isn't very expensive if you are not talking about hundreds. You could minify that by relying on the bubbling of key presses to parent objects. So instead of adding one to every object you could add a single handler to a container. The overhead of firing them is about the server round-trip which can be pretty expensive. I would refrain from adding too many..

FrankValcarcel
6-May-2014, 04:13 PM
Thanks. What I am looking at is adding the common keys: Zoom, Expand, Help, Escape, to all the classes to then be able to implement them in the object instances as needed. I would like to make the implementation logic similar to VDF. I just wanted to make sure that we are not adding a lot of overhead.

Am I correct that I could make it more efficient if I added properties like pbAllowZoom which I check in the OnLoad code and only Send AddKeyHandler if the property is set. The to use I would set the property and add the message to handle it.