[Chameleon] How to register function for ROI_CHANGED event?
Julien-Samuel Lacroix
jlacroix at mapgears.com
Fri Jul 7 09:02:47 EDT 2006
Hi Jacob,
There's a ONROICHANGED attribute in the ROIManager widget. I don't know
if it may help. For your problem, does the ROIAreaRegisterForEvent and
updateArea functions are printed in your result html page? And does the
ROIAreaRegisterForEvent get called in the OnLoad function?
You can maybe put some alert(); in the cwc_event.js file around line 151
(in the CWCEventManager_TriggerEvent) to see what happen.
Julien
Delfos, Jacob wrote:
> 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_
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
--
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/
More information about the Chameleon
mailing list