Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling events fired by Property of ActiveX Control in HTML/Javascript

The following HTML object represents an ActiveX control that has a property named SubSystemA:

<object id="MainObject"
    CLASSID="CLSID:2C327457-D12F-4FC4-BFC2-D7C029003D07"
    width="0px" height="0px"
    >
    <embed name="MainObject"></embed>
</object>

SubSystemA is a COM object implementing some interface with methods, properties, and events. SubSystemA's methods and properties are easily callable from Javascript, but since SubSystemA is a property of MainObject, I am not sure how to attach an event handler to SubSystemA's events.

I know of two ways to handle events fired by MainObject:

<script type="text/javascript">
    function MainObject::SomeMainEvent(arg1, arg2)
    {
         // Event handling logic
    }
</script>

and

<script type="text/javascript" for="MainObject" event="SomeMainEvent(arg1, arg2)">
    // Event handling logic
</script>

But how would one handle an event for MainObject.SubSystemA?

like image 649
Brandon Payton Avatar asked Nov 05 '22 20:11

Brandon Payton


1 Answers

I found that the following works:

<object id="MainObject"
    CLASSID="CLSID:2C327457-D12F-4FC4-BFC2-D7C029003D07"
    width="0px" height="0px"
    >
    <embed name="MainObject"></embed>
</object>

<script type="text/javascript">
    function MainObject.SubSystemA::SomeSubSystemEvent(arg1)
    {
         // Event handling logic
    }
</script>

and am currently looking for a way to adapt the <script for="..." event="..."> syntax, since it seems to allow later binding where the working syntax does not.

like image 179
Brandon Payton Avatar answered Nov 12 '22 12:11

Brandon Payton