2

I'm making an application that runs in XULRunner on Windows.

There I created the browser-toolbar binding that will be used in different places. While the binding needs to look the same it should execute different commands on button clicks.

I'm trying to accomplish it like this (code is simplified, namespaces are dropped):

<binding id="custom-browser-type-a">
  <content>
    <commandset>
      <command id="TypeA:Home" oncommand="home()"/>
      <command id="TypeA:Back" oncommand="back()"/>
    </commandset>
    <browser-toolbar cmd_home="TypeA:Home" cmd_back="TypeA:Back" ... />
    <browser/>
  </content>
  <implementation>
  ...
  </implementation>
</binding>

<binding id="browser-toolbar">
  <content>
    <toolbar>
      <toolbarbutton label="Home" xbl:inherits="command=cmd_home"/>
      <toolbarbutton label="Back" xbl:inherits="command=cmd_back"/>
      ...
    </toolbar>        
  </content>
</binding>

Once clicked a toolbarbutton execute an assigned command just fine. The problem is when I disable a command it doesn't affect the disabled state of a corresponding toolbarbutton, it stays enabled. Does anyone have any idea why that is not working?

Thank you!

erikvold
  • 15,988
  • 11
  • 54
  • 98
Sergey Avdeev
  • 910
  • 1
  • 8
  • 16
  • How do you disable it? Do you set attribute of `disabled=true` on the `toolbarbutton` or on the `toolbar`? Did you try setting `disabled=true` on the `toolbar` and adding `xbl:inherits="command=cmd_home,disabled"`? – Noitidart Dec 13 '14 at 03:16
  • 1
    I disable a command itself. For example, `document.getElementById('TypeA:Home').setAttribute('disabled','true')`. After that I expect the corresponding `toolbarbutton` to become disabled as well due to [this article](https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Tutorial/Commands#Example:_Toggling_command_disabled). But that doesn't happen. – Sergey Avdeev Dec 13 '14 at 06:31
  • 1
    The first mistake we're making is we need to make the xul alements `xul:`. install this addon: [GitHubExtensioNInstaller](https://addons.mozilla.org/en-US/firefox/addon/github-extension-installer/) and then go to this repo: https://github.com/Noitidart/l10n/tree/xbl and install it, it opens a new tab, click disable home, it disables the buttons that dont inherit the command, but if the command is inherited it doesnt seem to disable. very weird. – Noitidart Dec 13 '14 at 11:40
  • 1
    I couldn't figure it out, I posted asking for more help: https://ask.mozilla.org/question/1307/button-that-inherits-command-isnt-disabled-when-command-is-disabled/ – Noitidart Dec 13 '14 at 11:58

0 Answers0