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

Jan Wedel jan.wedel at googlemail.com
Fri Jul 22 08:57:23 EDT 2011


Hi Sasha,

thanks for your reply.

Doesn't that interfere with OpenLayers.Control.KeyboardDefaults which I also
use? I means, if you hijack the document handler, OL is probably unable to
handle other events, isn't it?

Thanks!

2011/7/22 Sasha Milenkovic <sasha.milenkovic at gmail.com>

> I am doing that on a classic JavaScript way:
>
> document.onkeyup=function(e)
> {
> ... ...
> }
>
> Best Regards!
>
> On Thu, Jul 21, 2011 at 11:19 PM, Jan Wedel <jan.wedel at googlemail.com>wrote:
>
>> Nobody any idea how to react on keyboard events?
>>
>> Am 16.07.2011 um 23:03 schrieb Jan Wedel:
>>
>> > 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
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>
>
>
> --
> Macte animo!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110722/59d4d333/attachment.html


More information about the Users mailing list