Author Topic: Interface for adding context menu items  (Read 6642 times)

darrylful

  • Guest
Is there an interface to add items to the context menu of the selected file(s)?

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34362
this will show in right click on the main panel:
mainMenuItem = DirectCast(mbApiInterface.MB_AddMenuItem("context.Main/Last.fm Playlist", Nothing, Nothing), ToolStripMenuItem)
add sub-menus if needed to mainMenuItem

in the click handler for a menu item to get the selected files:
if mbApiInterface.Library_QueryFiles("domain=SelectedFiles") then
    do
        filename = mbApiInterface.Library_QueryGetNextFile()
        if filename is nothing then exit do
        add filename to a list
    loop
end if

boroda

  • Sr. Member
  • ****
  • Posts: 4622
this code:
Code
ToolStripMenuItem mainMenuItem = (ToolStripMenuItem)mbApiInterface.MB_AddMenuItem("context.Main/Last.fm Playlist", null, null);
mainMenuItem.DropDown.Items.Add("text", null, null);
does nothing for me.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34362
its needs to be done in the NotificationType.PluginStartup event

boroda

  • Sr. Member
  • ****
  • Posts: 4622

darrylful

  • Guest
Code
ToolStripMenuItem mainMenuItem = (ToolStripMenuItem)mbApiInterface.MB_AddMenuItem("context.Main/Last.fm Playlist", null, null);
mainMenuItem.DropDown.Items.Add("text", null, null);
worked for me (in NotificationType.PluginStartup)
Thanks.

boroda

  • Sr. Member
  • ****
  • Posts: 4622
worked for me (in NotificationType.PluginStartup)
Thanks.
For me too. It was my fault. Thanks, Steven.