-
Notifications
You must be signed in to change notification settings - Fork 18
pyui.create_popup_menu
fabian-flassig edited this page Oct 14, 2024
·
3 revisions
Create a popup menu for the user to select one of multiple options. The popup menu will be discarded upon the next user interaction. It is populated at initialization with a list of options and will invoke the specified callback function when being closed. The popup menu can either be attached to a dialog control such as a button to mimic a drop-down button or to the cursor in the graphics to create a (right-click) context menu.
pyui.create_popup_menu(control, item_table)
control:create_popup_menu(item_table)| Type | Description | |
|---|---|---|
control |
control_handle or nil
|
Specifies the control below which the popup is created. nil will attach the popup to the mouse cursor. |
item_table |
{item1, ...} |
A table containing the list of popup menu items. |
Each popup menu item is represented by a table with the following options:
| Type | Description | |
|---|---|---|
item.text |
string |
Name of the popup menu item. An empty stril will create a menu separator and ignore the following options. |
item.submenu |
{item1, ...} |
A table containing the list of submenu items. It has the same structure as item_table
|
options.handler |
function |
A lua function that is invoked when clicking the item. |
This function is available in V26 and above.