The state of a broadcaster has to be changed explicitly for its observers to be updated:
<broadcasterset> <broadcaster id="save_command" disabled="false"/> </broadcasterset>
Once a broadcaster is defined, a XUL file may define elements that observe the broadcast command:
<button id="new" label="Save File" observes="save_command"/> <key id="key_new" xulkey="true" key="s" observes="save_command" /> <menuitem id="new_menuitem" label="New" observes="save_command"/>
<menuitem id="new_menuitem" value="New" observes="open_new"/> <observes element="open_new" attribute="disabled"/> </menu>
<commandset id="EditItems" oncommandupdate="updateCommandsetItems(this)" commandupdater="true" events="select"> <commandset id="moreEditItems" /> <command id="cmd_cut" oncommand="goDoCommand('cmd_cut');"/> <command id="cmd_copy" oncommand="goDoCommand('cmd_copy');"/> <command id="cmd_delete" oncommand="goDoCommand('cmd_delete');"/> </commandset>
<button id="cut-item" label="Cut" command="cmd_cut" enabled="true"/>
<key id="key_saveas" key="s" modifiers="control,shift" command="cmd_saveas"/>
Example 3-15 shows a simple window that you can load up that has all element sets: commands, broadcasters, and keys.