Options Type
Constructors
| Constructor |
Description
|
Full Usage:
Options(?click, ?role, ?type, ?label, ?sublabel, ?toolTip, ?accelerator, ?icon, ?enabled, ?acceleratorWorksWhenHidden, ?visible, ?checked, ?registerAccelerator, ?sharingItem, ?submenu, ?id, ?before, ?after, ?beforeGroupContaining, ?afterGroupContaining)
Parameters:
MenuItem * Option<BaseWindow> * KeyboardEvent -> unit
-
Will be called with click(menuItem, window, event) when the menu item is clicked.
?role : Role
-
Can be undo, redo, cut, copy, paste, pasteAndMatchStyle, delete, selectAll, reload, forceReload, toggleDevTools, resetZoom, zoomIn, zoomOut, toggleSpellChecker, togglefullscreen, window,
minimize, close, help, about, services, hide, hideOthers, unhide, quit, showSubstitutions, toggleSmartQuotes, toggleSmartDashes, toggleTextReplacement, startSpeaking, stopSpeaking, zoom, front, appMenu, fileMenu, editMenu,
viewMenu, shareMenu, recentDocuments, toggleTabBar, selectNextTab, selectPreviousTab, showAllTabs, mergeAllWindows, clearRecentDocuments, moveTabToNewWindow or windowMenu - Define the action of the menu item,
when specified the click property will be ignored. See roles.
?type : Type
-
?label : string
-
?sublabel : string
-
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || Available in macOS >=
14.4
?toolTip : string
-
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || Hover text for this
menu item.
?accelerator : string
-
An Accelerator string.
?icon : U2<NativeImage, string>
-
?enabled : bool
-
If false, the menu item will be greyed out and unclickable.
?acceleratorWorksWhenHidden : bool
-
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || default is true, and
when false will prevent the accelerator from triggering the item if the item is not visible.
?visible : bool
-
If false, the menu item will be entirely hidden.
?checked : bool
-
Should only be specified for checkbox or radio type menu items.
?registerAccelerator : bool
-
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌ || If false, the accelerator
won't be registered with the system, but it will still be displayed. Defaults to true.
?sharingItem : SharingItem
-
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ || The item to share
when the role is shareMenu.
?submenu : U2<Options[], Menu>
-
Should be specified for submenu type menu items. If submenu is specified, the type: 'submenu' can be omitted. If
the value is not a Menu then it will be automatically converted to one using Menu.buildFromTemplate.
?id : string
-
Unique within a single menu. If defined then it can be used as a reference to this item by
the position attribute.
?before : string[]
-
Inserts this item before the item with the specified id. If the referenced item doesn't exist the item will
be inserted at the end of the menu. Also implies that the menu item in question should be placed
in the same “group” as the item.
?after : string[]
-
Inserts this item after the item with the specified id. If the referenced item doesn't exist the item will
be inserted at the end of the menu.
?beforeGroupContaining : string[]
-
Provides a means for a single context menu to declare the placement of their containing group before the containing
group of the item with the specified id.
?afterGroupContaining : string[]
-
Provides a means for a single context menu to declare the placement of their containing group after the containing
group of the item with the specified id.
Returns: Options
|
|
Instance members
| Instance member |
Description
|
Full Usage:
this.accelerator
|
An Accelerator string. |
Full Usage:
this.acceleratorWorksWhenHidden
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ default is true, and when false will prevent the accelerator from triggering the item if the item is not visible. |
Full Usage:
this.after
|
Inserts this item after the item with the specified id. If the referenced item doesn't exist the item will be inserted at the end of the menu. |
Full Usage:
this.afterGroupContaining
|
Provides a means for a single context menu to declare the placement of their containing group after the containing group of the item with the specified id. |
Full Usage:
this.before
|
Inserts this item before the item with the specified id. If the referenced item doesn't exist the item will be inserted at the end of the menu. Also implies that the menu item in question should be placed in the same “group” as the item. |
Full Usage:
this.beforeGroupContaining
|
Provides a means for a single context menu to declare the placement of their containing group before the containing group of the item with the specified id. |
Full Usage:
this.checked
|
Should only be specified for checkbox or radio type menu items. |
Full Usage:
this.click
|
Will be called with click(menuItem, window, event) when the menu item is clicked. |
Full Usage:
this.enabled
|
If false, the menu item will be greyed out and unclickable. |
Full Usage:
this.icon
|
|
Full Usage:
this.id
|
Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute. |
Full Usage:
this.label
|
|
Full Usage:
this.registerAccelerator
|
⚠ OS Compatibility: WIN ✔ | MAC ❌ | LIN ✔ | MAS ❌ If false, the accelerator won't be registered with the system, but it will still be displayed. Defaults to true. |
Full Usage:
this.role
|
Can be undo, redo, cut, copy, paste, pasteAndMatchStyle, delete, selectAll, reload, forceReload, toggleDevTools, resetZoom, zoomIn, zoomOut, toggleSpellChecker, togglefullscreen, window, minimize, close, help, about, services, hide, hideOthers, unhide, quit, showSubstitutions, toggleSmartQuotes, toggleSmartDashes, toggleTextReplacement, startSpeaking, stopSpeaking, zoom, front, appMenu, fileMenu, editMenu, viewMenu, shareMenu, recentDocuments, toggleTabBar, selectNextTab, selectPreviousTab, showAllTabs, mergeAllWindows, clearRecentDocuments, moveTabToNewWindow or windowMenu - Define the action of the menu item, when specified the click property will be ignored. See roles. |
Full Usage:
this.sharingItem
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ The item to share when the role is shareMenu. |
Full Usage:
this.sublabel
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Available in macOS >= 14.4 |
Full Usage:
this.submenu
|
Should be specified for submenu type menu items. If submenu is specified, the type: 'submenu' can be omitted. If the value is not a Menu then it will be automatically converted to one using Menu.buildFromTemplate. |
Full Usage:
this.toolTip
|
⚠ OS Compatibility: WIN ❌ | MAC ✔ | LIN ❌ | MAS ❌ Hover text for this menu item. |
Full Usage:
this.type
|
|
Full Usage:
this.visible
|
If false, the menu item will be entirely hidden. |
fable-electron-docs-api