<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7226.0">
<TITLE>How to register function for ROI_CHANGED event?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hi List,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I'm trying to write a widget that displays the area of a ROI in a label, similar to the ruler widget. It all works, except I can't get it to respond to the ROI_CHANGED event, which gets triggered around line 242 of cwc_roi.js. By manually calling the function at that point, everything works fine. But obviously I'd prefer to use the event.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">I have pasted the relevant bits from my widget, hoping someone can see something I did wrong. </FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Thanks in advance,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Jacob</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">------------------------------Inside "GetJavascriptFunctions"------------------------------</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">$szJsFunctionName = "ROIAreaRegisterForEvent";</FONT>
<BR><FONT SIZE=2 FACE="Arial">$szFunction = <<<EOT</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">function {$szJsFunctionName}()</FONT>
<BR><FONT SIZE=2 FACE="Arial">{</FONT>
<BR><FONT SIZE=2 FACE="Arial"> goCWCROIManager.RegisterEvent(ROI_CHANGED, "updateArea");</FONT>
<BR><FONT SIZE=2 FACE="Arial">}</FONT>
<BR><FONT SIZE=2 FACE="Arial">EOT;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> $aReturn[$szJsFunctionName] = $szFunction;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> $szJsFunctionName = "updateArea";</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $szFunction = <<<EOT</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">function {$szJsFunctionName}()</FONT>
<BR><FONT SIZE=2 FACE="Arial">{</FONT>
<BR><FONT SIZE=2 FACE="Arial">[…]</FONT>
<BR><FONT SIZE=2 FACE="Arial">}</FONT>
<BR><FONT SIZE=2 FACE="Arial">EOT;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">$aReturn[$szJsFunctionName] = $szFunction;</FONT>
<BR><FONT SIZE=2 FACE="Arial">return $aReturn;</FONT>
<BR><FONT SIZE=2 FACE="Arial">------------------------------------------------------------------------------------------------------------------------</FONT></P>
<BR>
<BR>
<P><FONT SIZE=2 FACE="Arial">------------------------------------GetJavascriptOnLoadFunctions------------------------------------</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> function GetJavascriptOnLoadFunctions()</FONT>
<BR><FONT SIZE=2 FACE="Arial"> {</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $aReturn = array();</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> $aReturn = parent::GetJavascriptOnLoadFunctions();</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> $szJsFunctionName = "ROIAreaRegisterForEvent";</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $szFunction = "$szJsFunctionName();\n";</FONT>
<BR><FONT SIZE=2 FACE="Arial"> $aReturn[$szJsFunctionName] = $szFunction;</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial"> return $aReturn;</FONT>
<BR><FONT SIZE=2 FACE="Arial"> } </FONT>
<BR><FONT SIZE=2 FACE="Arial">------------------------------------------------------------------------------------------------------------</FONT>
</P>
<BR>
<BR>
<BR>
<P><B><FONT COLOR="#009500" FACE="Arial">J</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial">ACOB</FONT> <FONT COLOR="#009500" FACE="Arial">D</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial">ELFOS<BR>
</FONT><FONT COLOR="#009500" FACE="Arial">GIS</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial"></FONT> <FONT COLOR="#009500" FACE="Arial">A</FONT><FONT COLOR="#009500" SIZE=1 FACE="Arial">NALYST</FONT><BR>
</B><FONT COLOR="#000000" SIZE=2 FACE="Arial">Maunsell Australia Pty Ltd<BR>
629 Newcastle Street, Leederville, WA 6007</FONT>
<BR><FONT COLOR="#000000" SIZE=2 FACE="Arial">PO Box 81, Leederville, WA 6902</FONT>
<BR><FONT COLOR="#000000" SIZE=2 FACE="Arial">Western Australia</FONT>
<BR><FONT COLOR="#000000" SIZE=2 FACE="Arial">ABN 20 093 846 925<BR>
<BR>
Tel + 61 8 9281 6185<BR>
Fax + 61 8 9281 6297<BR>
</FONT><U><FONT COLOR="#009C21" SIZE=2 FACE="Arial">jacob.delfos@maunsell.com</FONT></U>
</P>
</BODY>
</HTML>