Bug 629 - [Chameleon - Widget] Add ability for ROI to call JS function when changed
: [Chameleon - Widget] Add ability for ROI to call JS function when changed
Status: RESOLVED FIXED
: Chameleon
Widget
: 1.99
: PC Windows XP
: P1 enhancement
: ---
Assigned To:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2004-08-25 14:46 by
Modified: 2004-08-25 15:12 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2004-08-25 14:46:04
Need the ability to call an arbitrary javascript function when the ROI changes.
------- Comment #1 From 2004-08-25 14:55:32 -------
This should be an optional attribute.  The function should be albe to accept 
arguments as discussed.
------- Comment #2 From 2004-08-25 15:12:29 -------
ability added.  ROIManager now has a ONROICHANGED attribute that can be set to
some javascript code to be executed when the ROI changes in some way.  

The implementation adds three new methods to the global ROI Manager object:

Public Functions:

* RegisterEvent( event, code )

this is called by a client of the ROIManager that wants to be informed when an
event happens.  In the case of the ROIManager widget, it automatically registers
the code in the ONROICHANGED attribute ... but any javascript code can
theoretically use it.

* DeregisterEvent( event, code )

this is called by a client to remove a registered call back.  Pass the same code
as was passed to the RegisterEvent

Private Functions:

TriggerEvent( event )

this is called internally to signal that an event has occurred, this function
will then invoke all the callbacks registered for an event.

There is currently only one event registered:

ROI_CHANGED

it is declared as a global javascript variable, so your code would look like:

<script>
function myROICallback()
{
    alert( 'roi changed' );
}
goROIManager.RegisterEvent( ROI_CHANGED, 'myROICallback( )' );
</script>