views:

67

answers:

1

Is it possible to capture a keypress of a div tag which is housing an active-x object? For example:

<body>
 <div id="silverlightControlHost">
  <object data="data:application/x-silverlight-2," 
        type="application/x-silverlight-2" 
        width="100%" height="100%">
  ...
  </object>
 </div>
</body>

As you can see this for a Silverlight object, as there's certain key presses the browser doesn't pass into Silverlight.

+2  A: 

I have no hard evidence to prove it, but the following sounds reasonable to me:

Events in the DOM rely on bubbling. The clicked element fires the event and then hands it over to its parent. Any element that does not do this stops the chain.

When an embedded object captures mouse and keyboard events, it would have to "ring" its parent DOM container manually. Security considerations (sandboxing) will prevent any such interaction.

Unless the controls expose an API that is designed to invoke DOM events, you are out of luck.

Tomalak