XUL Programmer's Reference Manual

<observes>

Attributes Common Children
element * * *
attribute  
id  

<observes> can be placed as a child of elements that want to observe particular attributes of other elements (Compare with the observes attribute on any element, which observes all the elements of the broadcaster).

In the following example, two interface elements, a menuitem and a checkbox, are observing the disabled attribute of the sound broadcaster. This observation means that the user interface elements will themselves be disabled when the value of the broadcaster's disabled attribute changes from false to true, as it may when the event listener loadSounds() is executed.

For more information about broadcasters and observes, see the Broadcasters and Observers XPToolkit documentation.

 
<broadcaster id="sound"
  oncommand="loadSounds()"
  disabled="false" /> 
...

<menuitem value="Sound Enabled"> 
  <observes element="sound" attribute="disabled"/> 
</menuitem>

...
<checkbox value="Sound On/Off" />
  <observes element="sound" attribute="disabled" />
</checkbox>
 
element
Description
The element attribute specifies the broadcasting element that is being observed.
Syntax
<observes element="id of broadcasting element" />
Example
<broadcaster id="cut" ... />
...
<observes element="cut"/>
Notes
When you use the <observes node and the element attribute, you must then specify which attributes of the broadcasting element are being observed.
 
 
attribute
Description
attribute names the particular attribute on the broadcaster that is being observed.
Syntax
<observes element="id of broadcaster"
   attribute="broadcasting attribute name" />
Example
<menuitem value="Sound Enabled"> 
  <observes element="sound" attribute="disabled"/> 
</menuitem>

...
<checkbox value="Sound On/Off" />
  <observes element="sound" attribute="disabled" />
</checkbox>
Notes
A value of "*" for attribute (i.e., attribute="*") picks up all of the attributes of the observing element with the exception of id.

 

 


 
 
Last updated: 1/2/01 Ian Oeschger