0
votes

I am developing a tiny Firefox Addon which has a Widget and a Panel. I passed the panel object inside widget constructor.

Panel is getting displayed when I click on Widget object. However, when I call panel.show([Widget Object]) in onAttach, it is giving me the error anchor.ownerDocument not defined.

If I call just panel.show(), it is showing the panel in the center of the browser window.

How can I set widget as panel's anchor in onAttach event?

If that is not possible, can I fire a click event on the widget so that onClick action happen and my panel comes up?

1
Why downvote after so many days? Moderators should look at this. Without reason a downvote should not be encouraged. - Ravindra Gullapalli

1 Answers

3
votes

Instead of using mainPanel.show(), use view.panel = mainPanel;:

myWidget = require('widget').Widget({
      id: "text-entry",
      label: "StrikeBase",
      contentURL: data.url("icon.png"),
//    panel: mainPanel,
      // Instead using this
      onClick: function(view) { 
//        mainPanel.show();
         // Instead using this              
          view.panel = mainPanel;
      }
});