Collapsible Menus Sample 5

This sample demonstrates one of the most powerful features in the latest version of the AddIn: support for a third state.
This third state is used to change the style of the currently selected items.
As you can see here, both the image and the color of the items that display submenus is changed as you click on them.

Here's how to setup a third style:

  • First of all, to activate this feature we must create a template command from which the AddIn will inherit the style:
    • Select the "(No Toolbar)" node on your project
    • Click Menu->Add Group
    • Name the group as [SelTemplate]
    • Click Menu->Add Command
    • Set the command's caption to "SelTemplate"
    • Uncheck the "Enabled" option


     

  • Now its just a matter of setting the style for this command: set the desired font, colors, selection effects, and images that you want to use when one of the menu items in your collapsible toolbar is selected.
    A couple of important things that you must keep in mind when setting the template command's styles:
    • The desired color, font, image and selection effects should be set for the "Normal" state only. The Over state will be ignored.
    • If you set a left, right or background image on the template, your standard menu items must also use a left, right and/or background image.
      For example, if you set a right image for the template command but the menu items on your collapsible toolbar doesn't have right images the AddIn will fail to apply the image.
    • Make sure the styles on the template command don't cause the command to grow in size.
      For example, if your standard menu items have a border size of "1" and the template command has a border size of "2" you will end with unpredictable (and most likely undesirable) results.