Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Browser control ate my shortcuts
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Browser control ate my shortcuts
Divers
Thread ID:
00936571
Message ID:
00936571
Vues:
51
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
Répondre
Fil
Voir

Click here to load this message in the networking platform