Adds new groups to existing tabs.
Syntax
Error = Send_Message(Ctrl, "OLE.AddGroups", Xml)
Parameters
Property | Description |
---|---|
Xml | The XML snippet used to add groups. |
Returns
An XML parsing error, or "" if the XML parsed successfully. (Added in 4.1.20)
Remarks
The AddGroups method allows you to add new groups to the ribbon at runtime. This is the only way to add new groups. Do not call Init multiple times.
To use this method, pass a string containing XML. It does not matter where the XML was originally stored. All that matters is that the one parameter you pass contains XML with one <AddGroups> element. Each XML element is documented on the wiki, but you'll want to start with the <AddGroups> element and work your way down.
Example
In the following example, we are adding a new group (which contains a bunch of new controls) to the Home tab. At the same time, we add a bunch of new empty groups to the already existing Insert tab.
Xml = '' Xml := '<AddGroups>' Xml := ' <Tab Key="HOME">' Xml := ' <Group Key="NAVIGATE" Caption="Navigation" OptionButton="true">' Xml := ' <Button Key="BTN_UP" BeginGroup="true">' Xml := ' <Command Key="UP" Caption="Up" Shortcut="Alt+Up" SmallIcon="Icons\arrow_up.png" />' Xml := ' </Button>' Xml := ' <Button Key="BTN_DOWN">' Xml := ' <Command Key="DOWN" Caption="Down" Shortcut="Alt+Down" SmallIcon="Icons\arrow_down.png" />' Xml := ' </Button>' Xml := ' <Button Key="BTN_LEFT">' Xml := ' <Command Key="LEFT" Caption="Left" Shortcut="Alt+Left" SmallIcon="Icons\arrow_left.png" />' Xml := ' </Button>' Xml := ' <Button Key="BTN_RIGHT">' Xml := ' <Command Key="RIGHT" Caption="Right" Shortcut="Alt+Left" SmallIcon="Icons\arrow_left.png" />' Xml := ' </Button>' Xml := ' </Group>' Xml := ' </Tab>' Xml := ' <Tab Key="INSERT">' Xml := ' <Group Key="PAGES" Caption="Pages" />' Xml := ' <Group Key="TABLES" Caption="Tables" />' Xml := ' <Group Key="ILLUSTRATIONS" Caption="Illustrations" />' Xml := ' <Group Key="APPS" Caption="Apps" />' Xml := ' <Group Key="MEDIA" Caption="Media" />' Xml := ' <Group Key="LINKS" Caption="Links" />' Xml := ' <Group Key="COMMENTS" Caption="Comments" />' Xml := ' <Group Key="HEADERFOOTER" Caption="Header & Footer" />' Xml := ' <Group Key="TEXT" Caption="Text" />' Xml := ' <Group Key="SYMBOLS" Caption="Symbols" />' Xml := ' </Tab>' Xml := '</AddGroups>' Send_Message(@Window:".OLE_RIBBON", "OLE.AddGroups", Xml)