Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Browser control ate my shortcuts
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Browser control ate my shortcuts
Miscellaneous
Thread ID:
00936571
Message ID:
00936571
Views:
50
Folks

I have web browser control on a form, but unlike other controls it sinks keyboard & mouse events, deny the containing form access through keypreview/keypress. Specifically, I have alt and ctrl key shortcuts on my main menu such as F5, ctrl-F and ctrl-N. The web browser assigns well known meanings to these.

I want it to passively display DHTML and respond only to PgUp, PgDn and mouse clicks so that my (>10 yrs old) main menu shortcuts still work.

I thought perhaps I could attach an event handler to the <body> tag of the browser document along these lines:

<body onkeypress="CancelCtrlAltBubble()">

function CancelCtrlAltBubble()
{if (window.event.ctrlKey||window.event.altKey) {
  window.event.cancelBubble = true;
  /* although I might want to do something else here */
}}

This certainly traps alt and ctrl key strokes, but as discussed at msdn the top level event handler is the HTML document object. This does not get us back to the control's container and VFP keypreview/keypress handling.

Any clues on how do this? It's probably something really simple.
In the mean time, I have changed my shortcuts to F2-F4 & F6-F10 which are not intercepted.

John Burton


MSDN articles at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconeventbubblingindhtmlapplications.asp
http://msdn.microsoft.com/workshop/author/om/event_model.asp
Reply
Map
View

Click here to load this message in the networking platform