5

I am actually trying to develop a Firefox extension using the high level apis, and specifically trying to avoid a panel to autohide when you pick a file or when you click outside of the panel itself.

Does somebody has an idea of how to do this?

I know that it is possible using XUL, so why is this not easy using the apis?

Thank you in advance for your answers.

1
  • 1
    Manny42 and @Noitidart: It is not in the API because Panel() based UI elements are intended for temporary use only. Only one panel created with Panel() is permitted to be open at a time across all Add-on SDK extensions installed in that profile. If another Add-on SDK extension opens a Panel(), yours will close. It is specifically programmed this way in the API source code, and I have tested/verified. For more information see this answer.
    – Makyen
    Jul 11, 2016 at 16:41

2 Answers 2

5

This is the offical sdk method of doing it:

let myPanel = Panel({.....})

let { getActiveView }=require("sdk/view/core");
getActiveView(myPanel).setAttribute("noautohide", true);
10
  • Well thank you for the effort, this SDK is killing me right now... I wonder if we can ask Mozilla... Or fill a bug report... Well thanks again!
    – Manny42
    Feb 10, 2014 at 3:31
  • ok no problem, by the way its messy and all, you know where i have that comment where i say its probably the last child but i want to verify. you dont have to do all that verification of adding event listenr and stuff, just get the recent window, and go "var panelsInMainpop = aDOMWindow.document.querySelectorAll('#mainpopupset panel'); var myPanel = panelsInMainpop[panelsInMainpop.length-1];"
    – Noitidart
    Feb 10, 2014 at 5:47
  • i suggest just put the widget in there with the sdk and on click of it create your own panel, what do you think?
    – Noitidart
    Feb 10, 2014 at 5:49
  • i posted here asking for help: forums.mozilla.org/addons/viewtopic.php?f=27&t=16038
    – Noitidart
    Feb 10, 2014 at 6:04
  • 1
    Im not familar @guido732 I havent been involved, you would need to post a new question.
    – Noitidart
    May 26, 2021 at 13:32
1

Idea from this

var toolbarbuttonPanel = doc.createElement('panel');
toolbarbuttonPanel.setAttribute('id', 'toolbarbutton-panel');
toolbarbuttonPanel.setAttribute('type', 'arrow');
toolbarbuttonPanel.setAttribute('noautohide', 'true'); // This is important

var toolbarbuttonLabel = doc.createElement('label');
toolbarbuttonLabel.setAttribute('value', 'toolbarbutton panel');
toolbarbuttonPanel.appendChild(toolbarbuttonLabel);

var mainPopupSet = document.querySelector('#mainPopupSet');
mainPopupSet.appendChild(toolbarbuttonPanel);

Then add this on sdk action/toggle button click:

toolbarbuttonPanel.openPopup(btn);

And Noitidart's comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.