Customizer's Guide > Working with ActiveX Controls > Executing ActiveX Controls Using the .dcf File to Bind to an Element dDrectly > Establishing Element-to-Control Binding
  
Establishing Element-to-Control Binding
Elements and ActiveX scripts are linked and bound to one another in the scripting environment with a naming convention that uses the control name specified in the ActiveXControl tag. Using the convention controlname_function, three script functions use this binding:
controlname_OnInitialize(activenode )
Performs all required control initialization, beyond that which might have been provided by any initialization file streams.
For example, the Cal_OnInitialize(activenode) function for a Calendar control might set the current date in the Calendar control according to any value in the current <date> element. Cal_OnInitialize(activenode) would retrieve the PCDATA:
The current date
and pass it to the Calendar.Value property to display as follows:
controlname_OnClose(activenode )
Modifies the XML data to reflect the final state of the ActiveX control. The function is not required, but is a logical way to synchronize the control data with the XML data. It is also a logical way to update the XML data in scripts that do not employ control event handlers.
When the user closes or cancels the dialog box, controlname_OnClose(activenode) is called if it exists in the active script. controlname_OnClose(activenode) is not called if the control is embedded in the document using inPlaceActivate.
controlname_OnCancel(activenode )
Performs any actions needed when Arbortext Editor closes a dialog box because its owner element was deleted. This function is optional, but can be useful to undo previous script actions in cases where XML data may have changed with control events. controlname_OnCancel(activenode) is not called if the control is embedded in the document using inPlaceActivate.