Author Topic: Add dropdownmenu to toolbarbutton  (Read 4359 times)

Offline Loguithat1955

  • Full Member
  • ***
  • Posts: 54
Add dropdownmenu to toolbarbutton
« on: January 09, 2018, 08:47:55 AM »
I know how to insert a new toolbarbutton to call a plugin. Is it possible to extend such a toolbarbutton, so that i have in addition to the normal button a submenu on the right side of this button? For example when im in the E-Mail List view and i have selected some e-mail, the button "answer all" becomes active. This "answer all" button has 2 functions. First when i click the button itself, i can answer all people in this mail and second, there is a small submenu on the right side of this button, if i click this, the submenu pops out and i can select "anser all" or "answer list". Now i would add such a submenu function also to a button in the toolbar. How can i do this?

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
Re: Add dropdownmenu to toolbarbutton
« Reply #1 on: January 09, 2018, 12:23:30 PM »
as you have probably noticed different skins implement the drop down menus in diffrent ways. so you need to make different versions of your menu item per skin. you might be able to get some ideas of how to do that from my contextmenu plugin - see https://github.com/johndoh/roundcube-contextmenu/blob/master/contextmenu.php#L59. here it reads the template file for the particular skin, parses it (the template files are written in Roundcube markup) and then I just dump the HTML into the page footer but I think you could put it into a menu container. Then to get your dropdown you can look at the existing template files for what ever skin you are using, and copy how its implemented changing the commands for your own.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and moreā€¦

Offline Loguithat1955

  • Full Member
  • ***
  • Posts: 54
Re: Add dropdownmenu to toolbarbutton
« Reply #2 on: January 10, 2018, 08:03:16 AM »
Hey, hello there. Of course I have installed your plugin, like probably a lot of others. So far I haven't thought about it and have never looked deeper at your plugin. But as I have noticed now, you can also extend other plugins with it. So I think it might be a better way to add some kind of right-click menu to the button of my plugin in the taskbar. I haven't understood everything about how it works internally, but I'll have a closer look at it in a quiet minute. If all this works out as I want, I would then add a right-click context menu to the Taskbar button.