add submenu in bootstrapped addon

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

add submenu in bootstrapped addon

opto
Howto add submenu under tools menu?

I found this: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/PopupGuide/MenuModification

  var popup = document.getElementById("taskPopup");
  var newmenu = document.createElement("menu");
  popup.appendChild(newmenu);
  newmenu.label = "New";
  newmenu.appendItem("Document", "doc");
  newmenu.appendItem("Image", "image");

It adds the menu to the taskPopup, but only shows label if I remove newmenu.label and use newmenu.setAttribute("label", "tag backup and restore");

It creates this as a menu, but the appenItem does .. nothing??

In the tools menu, I see a new entry like
tag backup and restore>

but it does not show a popup for the submenu.

What am I doing wrong? An help is appreciated.

Klaus

_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: add submenu in bootstrapped addon

opto
Am Sonntag, 15. April 2018 00:19:07 UTC+2 schrieb opto:

> Howto add submenu under tools menu?
>
> I found this: https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/PopupGuide/MenuModification
>
>   var popup = document.getElementById("taskPopup");
>   var newmenu = document.createElement("menu");
>   popup.appendChild(newmenu);
>   newmenu.label = "New";
>   newmenu.appendItem("Document", "doc");
>   newmenu.appendItem("Image", "image");
>
> It adds the menu to the taskPopup, but only shows label if I remove newmenu.label and use newmenu.setAttribute("label", "tag backup and restore");
>
> It creates this as a menu, but the appenItem does .. nothing??
>
> In the tools menu, I see a new entry like
> tag backup and restore>
>
> but it does not show a popup for the submenu.
>
> What am I doing wrong? An help is appreciated.
>
> Klaus

appendItem not working in TB 52.7.0. Workaround: add menupopup to menu. Then add menuitem to menupopup (all with appendChild to their parentelement).
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird