Separator in plugins menu

  • While searching through the forum I stumbled upon this post in the legacy forum:

    Seeing it's quite old I wonder if this is still the way to go to add separator(s) between plugin entries.
    Assume I have a single plugin file which registers multiple CommandData plugins, where I want a separator between some of them in the plugins menu.

    In the past I had used GetSubContainer to make "groups", but this has its drawbacks, so I would want to have a single list, with separators.

    According to the documentation related to RegisterCommandPlugin I found:

    To affect the order that plugins are displayed in menus add "#$n" as a prefix to this name, where n is a number.
    Lower numbers are displayed before higher numbers. If name is "--" it will show up as a menu separator. 

    But this would mean (as mentioned in the legacy forum post) one needs dummy plugin IDs.

  • I'm registering separators like this:

    // Separator
    static const Int32 PID_IM_SEPARATOR = 1000001;
    static const char* PNAME_IM_SEPARATOR = "#$09--"; // For positioning
    // Separator
    	if (!RegisterCommandPlugin(PID_IM_SEPARATOR, String(PNAME_IM_SEPARATOR), 0, nullptr, ""_s, Command_Settings::Alloc().GetValue()))
    		return false;

    Where the Alloc routine can be pointing to any already exisiting or a dummy Command plugin, since the separator is not executable.
    edit: Oh and yes, you have to register a custom ID, unfortunately.

  • Global Moderator


    yes, this is still the "official" way to add separators to the Plugins menu.