[mapguide-users] can IE7 capture key presses?

J Manafi jonathan.manafi at cctechnol.com
Tue Jul 8 12:15:19 EDT 2008


Update:

I cleaned up the code a bit to explicitly check for
addEventListener/attachEvent capabilities, and executed the correct
statements based on that.


document.attachEventListener('keydown', myFunction, false);

parent.parent.mapFrame.addEventListener('keydown', myFunction, false);

or

document.attachEvent('onkeydown', myFunction);

parent.parent.mapFrame.document.attachEvent('onkeydown', myFunction);


Maybe someone can find this useful in the future.


J Manafi wrote:
> 
> I have some javascript set to capture key combinations, like shift+a or
> ctrl+d, and then I set my function as the callback to the document
> onkeydown events, like so:
> 

> document.onkeydown = myFunction;

> parent.parent.mapFrame.onkeydown = myFunction;
> 

> In IE, if I open my taskPane script and do any work in there, I can
> capture my key presses. However, if I open the context menu on the map
> and, let's say, choose the selection icon, I no longer have the ability to
> capture keys unless I click back in the taskPane. This works fine in
> firefox.
> 

> I'm  not entirely sure of all of the differences between firefox and IE,
> but I was wondering if someone knew perhaps of a way to gain access to
> mapFrame javascript events?
> 

> Thanks,

> Jonathan
> 

-- 
View this message in context: http://www.nabble.com/can-IE7-capture-key-presses--tp18319148p18342985.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080708/2dc6b610/attachment.html


More information about the mapguide-users mailing list