[OpenLayers-Users] How to add a Keyboard handler to a map?

Jan Wedel jan.wedel at googlemail.com
Sat Jul 16 17:03:47 EDT 2011


Hi!

I'm trying to get the keyboard handler to work. I want to catch the keypress event, especially for the space key and hide/display the overlay layer of my map. 

1.) How can I set up the handler to react on keypressed events? In the APi, it says the callbacks object should contain exactly one function that takes the position of the mouse pointer which is not what I want.
2.) On my callback function, how can I find out what key was actually pressed?
3.) How can I "install" this handler? There is no addHandler method in OpenLayers.Map class...

I tried to find some information in the API documentation but it doesn't answer my question!

Thanks a lot!

//Jan


More information about the Users mailing list