0

I have this code:

<?xul-overlay href="chrome://myextention/popup.xul"?>

<toolbarbutton id="button" type="menu">
    <panel id="popup" />
</toolbarbutton>

When I click the button it opens the popup panel. Now I want to open the same panel when I click an element in another window. I'm getting the current browser with navigator:browser, finding the panel ( e.g. panel.state works ) and trying to open it but it doesn't work.

I've tried openPopup, open = true and openPopupAtScreen - none of this works. Any ideas?

Daniel J F
  • 1,054
  • 2
  • 15
  • 29

1 Answers1

2

openPopup is definitely the correct way to open the panel.

I believe the problem is that you've made the panel child of the toolbarbutton.

I would suggest making the panel a separate item in the XUL (a child of mainPopupSet).

Then use openPopup in both cases.

Mike Kaply
  • 747
  • 3
  • 12
  • I moved the panel outside the button and added `click` event on the button: `$panel.openPopup()`. It works. After that I added `click` event on an element in another window (`window.open`) and again, even though I get the panel element, it ignores `openPopup`. – Daniel J F Apr 13 '12 at 12:16
  • Would it be possible for you to post some more code? I'm not sure what you mean by "ignores openPopup" If a popup is already open and you call openPopup, it won't be moved to the new location. You would have to hide and reopen. – Mike Kaply Apr 25 '12 at 22:28