Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In the SRP Ribbon Control, you define a save command and process one event called OnCommand. That event passes you the name of the command, and you process it accordingly. When you add buttons to the ribbon, you associate them to a command. So, you can have three save buttons on your ribbon and each one would fire the same event. Better yet, when you disable the save command, all three buttons are disabled in unison.

Commands are defined in the initialization XML. See the <Command> tag for details.

Keys

Almost everything you define in the SRP Ribbon Control has a key. A key is a string that is unique to that item. Each command has a unique key as does each control. By using keys instead of numerical indexes, it makes it much easier to manipulate the ribbon at runtime. For example, it's much more intuitive to disable a command by name, such as "SAVE", than by index, such as "3". If something is not working, you might want to double check your key names.

...

Tabs are usually the first things you define. Tabs do not have icons, only captions. Most of your tabs will have the same visual theme, but you can also add special tabs that are custom colored. For example, in Microsoft Word when you select a table, two new tabs appear highlighted in yellow. Those are called context sensitive tabs. See the <Tabs> XML tag for details on defining tabs.

Groups are the little panes that appear within a single tab. Every group must have a unique key even if the groups are not in the same tab. Groups can have an option button in the bottom corner. When that button is clicked, an OnGroupOptionClick event is fired. Also, as the ribbon shrinks in size and groups get smaller, they will eventually collapse into a popup, so you can associate an icon with the group which will be displayed in that scenario. The <Group> tag is used in the setup XML to define groups.

Controls are placed within groups. There are many kinds of controls supported, and more controls will be added in the future. Some controls are simple, like buttons. Others are more complex, such as split buttons, which display a popup which can contain more controls. Yes, you can have a popup within a popup within a popup. This is why unique keys are useful and why setting up the control can be complex. See the <Group> tag for a list of available controls.

The last element of the ribbon control is the Backstage. The backstage is what appears when the user clicks the system button. The system button is either a round button in the top left corner of the ribbon or a blue tab at the beginning of the tab bar. The backstage fills up the entire form when visible. It has a side bar along the left which can be populated with either buttons or pages. Buttons and pages are both associated with commands. Buttons simply fire the OnCommand event when clicked. Pages display an embedded OI form on the right, which are defined by including the <Page> tag in the XML setup and calling thethe EmbedWindow method during the CREATE event of your form.