Initial state of buttons wrong when located in app panel. #19

Gitoffthelawn opened this Issue Nov 5, 2014 · 3 comments


None yet

3 participants


When the buttons are located in the app panel, the initial visible state of all the buttons is off (red), even if the functionality they represent is not off. For example, images button will be red even though images are not disabled.


This is because the "customizationchange" listener the add-on implements is not enough. For example, if you place QJ's buttons in any of the Puzzle Toolbars the same thing will happen (PS never mind the faulty/cropped icons in this case, I've already fixed it in the latest PZT beta).

In both cases, the toolbars/panel are created after the buttons whole initialization, and the "customizationchange" event isn't fired when the buttons are automatically placed there at this point to update their status.

Simple solution: instead of the customizationchange event listener, implement a listener with CustomizableUI like the following:

var CUIListener = {
  handler: function() {
    /* Our toolbar icons may have been added or removed to/from a toolbar or panel */
  onWidgetAdded: function(aWidgetId) { this.handler(); },
  onWidgetRemoved: function(aWidgetId) { this.handler(); },
  onAreaNodeRegistered: function() { this.handler(); },
  onAreaNodeUnregstered: function() { this.handler(); }

Bonus points for filtering those events for your widget ids only. :)
Useful information about CustomizableUI and its listeners if you'd like:

@Quicksaver Quicksaver referenced this issue in Quicksaver/Puzzle-Toolbars Dec 6, 2014

QuickJava buttons erroneously red until refreshed #64


Version 2.0.6 should fix this issue and has been submitted for review.

To install 2.0.6 early visit this page:

Thanks to @Quicksaver for the code snippet


You're very welcome, I'm glad it worked. :) Just wanted to confirm that everything works great for me with QJ's buttons with all (puzzle) toolbars and the menu panel as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment