Ribbon Customization
§ Define properties of the ribbon command
§ Create a drop-down menu for the command
§ Define properties of the command’s drop-down menu
To add a <Ribbon> element:
§ Set the <Ribbon> element’s Show attribute to 1.
<Tool caption="Data Analysis" id="ACO009" Path="MyToolFolder\MyTool.html">
<RibbonShow="1" Toggle="0"/>
</Tool>
Define properties of the ribbon command
To determine basic properties of the ribbon command:
§ Set the following values:
· Tool Name – To set the name of the tool as it should be displayed on the ribbon command and on the tool window, set the <Tool> element’s caption attribute.
· Ribbon Tab – To set the ribbon tab in which the new ribbon command should be placed, set the <Category> child element under the <Ribbon> element.
· Ribbon Group – To set the ribbon group in which the new ribbon command should be placed, set the <Panel> child element under the <Ribbon> element.
· Command Tooltip – To set the tooltip that is displayed when placing the mouse cursor over the ribbon command, set the <ToolTip> child element under the <Ribbon> element.
· Command Icon – To set an icon for the new ribbon command, set the <Icon> child element under the <Tool> element.
<Tool caption="Data Analysis" id="ACO009" Path="MyToolFolder\MyTool.html" NeedProject="0" >
<Iconpath="MyAddon.ico"/>
<RibbonShow="1" Toggle="0">
<Category id="MyTabId" caption="My Tab"/>
<Panel id="MyGroupId" caption="My Group" />
<ToolTip title="My Tooltip" description="Tool for demonstrating add-on use"/>
</Ribbon>
</Tool>
Create a drop-down menu for the command
Custom ribbon buttons can be created with drop-down menus that enable you to group several tools under one button, allowing better organization of customized tools and minimizing ribbon clutter.
To create a drop-down menu:
1. Set the <Submenu> child element under the <Ribbon> element.
2. For each of the drop-down menu options, create an <Item> child element under the <Submenu> element:
a. Uniquely identify the command that is being added to the drop-down menu by setting the <Item> element’s id attribute.
b. Define the path to the HTML page opened by the option by setting the <Item> element’s Path attribute.
c. Set the name of the option as it should be displayed in the drop-down menu by setting the <Item> element’s Caption attribute.
3. If you want to create a sub-command icon and tooltip, set the <Tooltip> and <Icon> child elements under the <Item> element.
<Tool caption="Data Analysis" id="ACO009" Path="MyToolFolder\MyTool.html" >
<Iconpath="MyAddon.ico"/>
<RibbonShow="1" Toggle="0">
<Category id="MyTabId" caption="My Tab"/>
<Panel id="MyGroupId" caption="My Group" />
<ToolTip title="My Tooltip" description="Tool for demonstrating add-on use"/>
<Submenu>
<Item caption="My SubmenuOption" id="MySubId" Path="MySubmenuToolFolder\MySubmenuTool.html">
<ToolTip title="My Tooltip" description="Tool for demonstrating submenu use"/>
<Icon path="MySubmenuOption.ico"/>
</Item>
</Submenu>
</Ribbon>
</Tool>
Define additional properties of the command’s drop-down menu
The tool’s ribbon command can be set to only open a drop-down menu, or alternatively, set with dual functionality, where clicking the bottom half of the button opens a drop-down menu with sub-options, while clicking the upper half activates the “main” tool option, which will also be listed first in the drop-down menu.
To determine button functionality:
§ Set the value of the <Ribbon>’s splitButton attribute:
· splitButton = “0” - Button only opens a drop-down menu.
· splitButton = “1” (Default) Button is split into two halves with the functionality described above.
To format the drop-down menu:
§ Use the <Submenu> child elements:
· <Separator> - Creates horizontal divider lines in the drop-down menu.
· <GroupTitle> - Creates headings in the drop-down menu.
<Tool caption="Data Analysis" id="ACO009" Path="MyToolFolder\MyTool.html">
<Iconpath="MyAddon.ico"/>
<RibbonShow="1" Toggle="0" splitButton="1">
<Category id="AnalysisTools" caption="Graphs"/>
<Panel id="MyGroupID" caption="Analysis" />
<ToolTip title=“My Tooltip” description="Tool for demonstrating add-on use"/>
<Submenu>
<GroupTitle>MyGroup1</GroupTitle>
<Item caption="My SubmenuOption1" id="MySubId1" Path="MySubmenuToolFolder\MySubmenuTool1.html">
<ToolTip title="My Tooltip1" description="Tool for demonstrating submenu use"/>
<Icon path="MySubmenuOption1.ico"/>
</Item>
<Separator></Separator>
<Item caption="My SubmenuOption2" id="MySubId2" Path="MySubmenuToolFolder\MySubmenuTool2.html">
<ToolTip title="My Tooltip2" description="Tool for demonstrating submenu use"/>
<Icon path="MySubmenuOption2.ico"/>
</Item>
<GroupTitle>MyGroup2</GroupTitle>
<Item caption="My SubmenuOption3" id="MySubId3" Path="MySubmenuToolFolder\MySubmenuTool3.html">
<ToolTip title="My Tooltip3" description="Tool for demonstrating submenu use"/>
<Icon path="MySubmenuOption3.ico"/>
</Item>
</Submenu>
</Ribbon>
</Tool>