ContextMenu
Use the non-visual ContextMenu
element to declare a context menu.
The context menu is shown if the user right-clicks on the area covered by the ContextMenu
element,
or if the user presses the “Menu” key on their keyboard while a FocusScope
within the ContextMenu
has focus.
Call the show()
function on the ContextMenu
element to programmatically show the context menu.
Define the structure of the menu by placing MenuItem
elements into the ContextMenu
.
Function
show(Point)
Call this function to programmatically show the context menu at the given position relative to the ContextMenu
element.
close()
Close the context menu if it is currently open.
MenuItem
A MenuItem
represents a single menu entry. It can be placed as a child of a ContextMenu
,
MenuBar, or another MenuItem
.
Properties of MenuItem
title
string default: ""
The label of the entry within the menu.
Callbacks of MenuItem
activated()
Invoked when the menu entry is activated.
Example
export component Example { ContextMenu { MenuItem { title: @tr("Cut"); activated => { debug("Cut"); } } MenuItem { title: @tr("Copy"); activated => { debug("Copy"); } } MenuItem { title: @tr("Paste"); activated => { debug("Paste"); } } }}
© 2025 SixtyFPS GmbH