WklButton
WklButton is the command button of the current Office look for Access forms: caption with
access key, a symbol from Segoe Fluent Icons, four styles, and a menu, split or segment variant in
the same control. It is meant for command bars in form headers and for dialogs; for the
developer it works like Access's own command button.
Get started
Common tasks
Visual aid
+- frmCustomers: Form header ----------------------------------------------------------+
| Customers [1 (+) New ] [2 (S) Save | v ] [3 View v] [4 (!)3] |
| [5 List | Cards | Map ] |
+--------------------------------------------------------------------------------------+
[3] opened:
+-----------------------------+
| (+) New Ctrl+N |
|-----------------------------|
| * Day |
| Week |
| (E) Export > |---+ Excel |
| Delete all (disabled) | | PDF |
+-----------------------------+ +-------+
| Region | Meaning |
|---|---|
| 1 | Command button (Kind = wbkButton), style “Primary command” (wbsPrimary): raises Click |
| 2 | Split button (wbkSplit): the main part raises Click, the arrow opens the menu with the variants (“Save As”) |
| 3 | Menu button (wbkMenu), style “Subtle” (wbsSubtle): opens the menu - entries with symbol and shortcut text, an option group, a submenu, a disabled entry |
| 4 | Button showing only its symbol (GlyphPosition = wgpOnly) with a count badge (BadgeCount) |
| 5 | Segment button (wbkSegment): options side by side, one selected, Change when the user picks another |
Key features
- One control, four kinds (
Kind): command button, menu button, split button, segments. - Office look: rounded corners, the Fluent styles Standard, Primary command, Subtle, and Danger, hover and pressed states, the two-color focus ring; system colors in high contrast.
- Menus without CommandBars: entries with symbol, shortcut text, check mark, option group, disabled reason and one submenu level, designed with the form or filled in code just before the menu opens (
DropDown). The same menu runs in Access, the Access Runtime, Excel and Word. - Segments like an option group: one tab stop, the arrow keys select, the user cannot clear a single selection;
MultiSelectturns each segment into a toggle. - Count badge (
BadgeCount,BadgeKind,BadgeDot) in the colors ofWklNavBarbadges. - Access conventions kept:
Captionwith&,Click; Enabled, Visible, ControlTipText and TabStop are those Access gives every control. Events occur after the click or the menu has ended, so an event procedure may show a message box or close the form. - Designer (row Custom
[...]): kind, caption, symbol, style, badge, colors, the menu and the segments as tables, with a preview. - Keyboard and screen readers: Space and Enter press, Alt+Down or F4 open the menu; screen readers hear a button, a split button or a list of options with the caption and the badge count.
Core concepts
The developer's side is Access's. A WklButton is enabled, hidden, given a tooltip and put
into the tab order exactly like a command button, through the property sheet and the same
properties in code. With Enabled set to No, Access removes the control's window; the button then
draws itself gray.
Design and run time. What is set in design view - caption, style, menu, segments and their
selection - is stored with the form. Changes made by code in form view (filling the menu in
Form_Load, a badge count, the selection) are not a change of the form and are not stored; code
that fills the menu starts with ClearMenu, because a key may occur only once.
Events come from the user. Click, DropDown, MenuItemClick and Change report what the
user did - with the mouse, the keyboard or a screen reader. Setting SelectedKey or
MenuItemChecked by code raises nothing, as setting the value of an Access control raises no
AfterUpdate.
Administration
Troubleshooting
For developers
Related topics
None