Export (0) Print
Expand All

createEventObject method

Creates an event object that can be used to pass event context information to the PUBLIC:EVENT element's fire method.

Syntax


var ppEventObject = element.createEventObject();

Parameters

ppEventObject [out, retval]

Type: IHTMLEventObj

Returns an event object.

Return value

This method does not return a value.

Remarks

The same event object cannot be reused in multiple calls to the fire method.

All properties of the event object that is created using IHTCDefaultDispatch::createEventObject are read/write, including those properties that would be read-only in Dynamic HTML (DHTML). You can use the HTML Component (HTC) file to set properties on the event object before firing an event.

Examples

This example is derived from a calculator behavior sample. When the result changes, the behavior fires a custom onResultChange event back to the page, passing the result as a custom property of the event object.


<public:event name="onResultChange" id="rcID" />

<script language="javascript">

:
function doCalc()
{
   :
   oEvent = createEventObject();
   oEvent.result = sResult;
   rcID.fire (oEvent);
}
</script>

This example shows what the containing page looks like.


<html xmlns:InetSDK>
<head>
<style>
@media all {
   InetSDK\:CALC    {behavior:url(engine.htc)} 
}   
</style>
</head>

<InetSDK:CALC id="myCalc"
    onResultChange="resultWindow.innerText=window.event.result">
<table>
<tr><div id="resultWindow" style="border: 0.025cm solid gray;" align="right">0.</div></tr>
<tr><td><input type="button" value=" 7 "></td>
    <td><input type="button" value=" 8 "></td>
    <td><input type="button" value=" 9 "></td>
    <td><input type="button" value=" / "></td>
    <td><input type="button" value=" C "></td>
</tr>
    :   
</table>
</InetSDK:CALC>
</html>

Code example: http://samples.msdn.microsoft.com/workshop/samples/components/htc/calc/calc.htm

See also

element
Reference
IHTMLNamespace::detachEvent
Conceptual
Introduction to DHTML Behaviors
Introduction to Viewlink
About Element Behaviors

 

 

Community Additions

ADD
Show:
© 2014 Microsoft