The “Help” menu of a software is handy. Obviously, you have a menu item to open the online documentation of the software, but also how to contact the support, and several other items depending on the software.
With 4D v20, you can easily create your application’s “Help” menu by passing a collection describing the different menu items.
A new command SET HELP MENU is available. You just have to pass a collection of objects to this command. Each object represents a menu item. For each item, you can define the following:
- title – the title of the menu item
- action – a standard action that will be executed when the menu is called
- method – a method name or a formula that will be executed when the menu is called
- worker – the name of a worker or the number of a process
- shortcutAlt, shortcutShift, and shortcutKey – the shortcut to trigger the menu
Example:
In the following code, we create two menu items.
- The first one calls the “methodMenu” method, and uses the shortcut key Ctrl+Alt+Y on Windows and Cmd+Alt+Y on macOS.
- The second one calls the “Maintenance and Security Center” action and uses the shortcut key Ctrl+Shift+Y on Windows and Cmd+Shift+Y on macOS
var $col : Collection
$col:=New Collection
$col.push(New object( \
"title"; "Call \"methodMenu\" method"; \
"worker"; "workerMenu"; \
"method"; "methodMenu"; \
"shortcutAlt"; True; "shortcutKey"; "Y"))
$col.push(Null)
$col.push(New object( \
"title"; "Call \"MSC\" action"; \
"action"; ak msc; \
"shortcutShift"; True; "shortcutKey"; "Y"))
SET HELP MENU($col)
Here is the result:
Don’t forget to consult the 4D documentation for more in-depth information on this new feature, and share your feedback and ideas on the 4D forum to help us continue improving the software.