Customizer's Guide > Working with ActiveX Controls > Executing ActiveX Controls Using XUI > Example: Embedded Calendar Control > Implementation
  
Implementation
Use the following steps to implement this example:
1. Specify the control to call and its layout with the following markup saved as date.xml:
<?xml version="1.0" encoding="utf-8"?>
<!--ArborText, Inc., 1988-2003, v.4002-->
<!DOCTYPE window PUBLIC "-//Arbortext//DTD XUI XML 1.0//EN"
"xui.dtd">
<window width="400" height="300" orient="horizontal"
focus="todayButton" modal="false" title="Test ActiveX"
xmlns:ev="http://www.w3c.org/2001/xml-events">
<activex id="date" progid="MSCAL.Calendar">
<script type="application/x-jscript" ev:event="Value_OnChange"
ev:target="date">
var node = Application.activeDocument.getElementById("date");
if (node.hasChildNodes()) {
node.firstChild.data = date.Value;
}
else {
var text = node.ownerDocument.createTextNode(date.Value);
node.appendChild(text);
}
</script>
</activex>
<spacer resize="none" width="4"/>
<box resize="none" orient="vertical" pack="end">
<button id="todayButton" label="Today">
<script type="application/x-jscript" ev:event="domactivate">
date.Today();
</script>
</button>
<button label="Close" type="cancel">
<script type="application/x-jscript" ev:event="domactivate">
var dialog = Application.event.view.window;
dialog.close();
</script>
</button>
</box>
<script type="application/x-jscript" ev:event="windowload">
date.Today();
</script>
</window>
2. Configure the .dcf file to assign the file date.xml to the <date> element:
<Specials>
<XuiControl element="date" xuiFileName="date.xml"/>
3. Open a document that uses the DTD for which you've configured the .dcf file and insert a <date> element. For example, using the default axdocbook stylesheet, the following markup renders in Arbortext Editor as.
Calendar control embedded in a document
<?xml version="1.0" encoding="utf-8"?>
<!--ArborText, Inc., 1988-2003, v.4002-->
<!DOCTYPE book PUBLIC "-//Arbortext//DTD DocBook XML V4.0//EN"
"axdocbook.dtd">
<?Pub Inc?>
<book>
<title>ActiveX Examples</title>
<bookinfo>
<revhistory>
<revision>
<revnumber>1</revnumber>
<date id="date"></date>
</revision>
</revhistory>
</bookinfo>
...
</book>