Widget.contextMenu

Override this to provide a custom context menu for your widget. (x, y) is where the menu was requested. If x == -1 && y == -1, the menu was triggered by the keyboard instead of the mouse and it should use the current cursor, selection, or whatever would make sense for where a keyboard user's attention would currently be.

It should return an instance of the Menu object. You may choose to cache this object. To construct one, either make new Menu("", this); (the empty string there is the menu's label, but for a context menu, that is not important), then call the menu.addItem(new Action("Label Text", 0 /* icon id */, () { on clicked handler }), menu); and menu.addSeparator() methods, or use return createContextMenuFromAnnotatedCode(this, some_command_struct);`

Context menus are automatically triggered by default by the keyboard menu key, mouse right click, and possibly other conventions per platform. You can also invoke one by calling the showContextMenu method.

class Widget
contextMenu
(
int x
,
int y
)

See Also

Meta