- Handling the Ribbon control and its groups
- Handling a Ribbon control
- Collapsing a Ribbon control
- Handling a group
- Forcing a group to close
- Properties specific to Ribbon controls
Handling Ribbon controls programmatically
WINDEV allows you to programmatically handle Ribbon controls, as well as their tabs and groups.
The name of the Ribbon control is used to handle the Ribbon and its tabs programmatically.
The names of the groups are used to handle groups programmatically.
Remark: You don't need to program how to switch between tabs.
Handling the Ribbon control and its groups
Handling a Ribbon control
To handle a tab of the Ribbon control, use the following syntax:
<Ribbon Name>[TabNumber].PropertyName = <Value>
To gray out the second tab of the Ribbon control, you can use the following syntax:
RIBBON_Menu.Grayed = True
The first tab of the ribbon is active by default. The active tab can be changed programmatically:
- using the following syntax:
<Ribbon Name> = <Tab Number>
- using the Value property.
To get the number of the active tab, you can:
- use a simple assignment expression:
<Active Tab Num> = <Ribbon Name>
- use the Value property.
property gets and sets the text of the active tab. For example:
Collapsing a Ribbon control
property collapses (or not) a Ribbon control. If the Ribbon control is collapsed, only the text of the tabs are displayed (like in a standard menu). The content of the tab is displayed when the user clicks the tab. If the user clicks the tab again (or one of the buttons in the tab), the content of the tab is no longer displayed.
To force the tab to disappear on a user action (when the user selects a Combo Box control for example), simply use RibbonEndExpandedMode.
Handling a group
The following syntax is used to handle a groupe:
<Ribbon Name>.<Groupe Name>
RIBBON_Menu.GRITEM_QuickAccess.Visible = False
Forcing a group to close
In a Ribbon control, the small groups display an icon and an arrow used to open a popup that contains all the controls.
By default, this popup is closed:
- when the user clicks a button,
- when the user performs a selection in a Combo Box control.
To set a different action that closes the group (e.g., entering 3 characters), use RibbonCloseGrouping
in the desired process.
Properties specific to Ribbon controls
The following properties can be used with a Ribbon control:
|Collapsed||Used to collapse (or not) a Ribbon control. If the Ribbon control is collapsed, only the text of the tabs is displayed. When clicking the text of the tab, it is entirely displayed with all its groups.|
|Count||Gets the number of tabs of a Ribbon control.|
|Undocked||Allows you to know if a tab is detached from a Ribbon control.|
For a complete list of WLanguage properties that can be used with a Ribbon control, see Properties associated with Ribbon controls