[Chameleon] How to register function for ROI_CHANGED event?

Delfos, Jacob Jacob.Delfos at maunsell.com
Thu Jul 6 23:37:26 EDT 2006


Hi List,

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.

I have pasted the relevant bits from my widget, hoping someone can see something I did wrong. 

Thanks in advance,

Jacob


------------------------------Inside "GetJavascriptFunctions"------------------------------

$szJsFunctionName = "ROIAreaRegisterForEvent";
$szFunction = <<<EOT

function {$szJsFunctionName}()
{
    goCWCROIManager.RegisterEvent(ROI_CHANGED, "updateArea");
}
EOT;

       $aReturn[$szJsFunctionName] = $szFunction;

       $szJsFunctionName = "updateArea";
        $szFunction = <<<EOT

function {$szJsFunctionName}()
{
[...]
}
EOT;

$aReturn[$szJsFunctionName] = $szFunction;
return $aReturn;
------------------------------------------------------------------------------------------------------------------------



------------------------------------GetJavascriptOnLoadFunctions------------------------------------

    function GetJavascriptOnLoadFunctions()
    {
        $aReturn = array();

        $aReturn = parent::GetJavascriptOnLoadFunctions();

        $szJsFunctionName = "ROIAreaRegisterForEvent";
        $szFunction = "$szJsFunctionName();\n";
        $aReturn[$szJsFunctionName] = $szFunction;


        return $aReturn;
    } 
------------------------------------------------------------------------------------------------------------




JACOB DELFOS
GIS ANALYST
Maunsell Australia Pty Ltd
629 Newcastle Street, Leederville, WA 6007
PO Box 81, Leederville, WA 6902
Western Australia
ABN 20 093 846 925

Tel     + 61 8 9281 6185
Fax    + 61 8 9281 6297
jacob.delfos at maunsell.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20060707/aa68ab8b/attachment.html


More information about the Chameleon mailing list