PLUG'N SCRIPT
rapid plugin development
Tutorial
DSP
KUIML
How-to
Scripts
  • Tutorial
  • Element Reference
Language basics
  • SKIN
  • DUMMY
  • INCLUDE
  • INCLUDE_ONCE
  • DEFINE
  • UNDEFINE
  • VARIABLE
  • LOCAL_VARIABLE
  • TEMPLATE
  • TEMPLATE_INNER_CONTENT
  • REPEAT
Data model
  • PARAM
  • ACTION
    • Action types
  • ACTION_TRIGGER
  • TIMER
UI Layout and positioning
  • CELL
  • TABLE
UI Widgets
  • CANVAS
    • Graphics API
  • COLOR_SCALE
  • FILE_SELECT_MENU
  • GRID
  • INVISIBLE_PARAM_MENU_BUTTON
  • MENU_ITEM
  • MENU_SEPARATOR
  • POPUP_MENU
  • svg
  • RULER
  • TEXT
  • TEXT_FIELD
  • TEXT_EDIT_BOX
  • XY_PARAM_PAD
  • XY_ZOOM_SELECT_PAD
  • XYZ_PARAM_SCRATCH_PAD
  • XYZ_PARAM_CLICK_PAD
  • XYZ_IMAGE_PARAM_JOYSTICK
UI 3D Objects
  • COLOR_SURFACE_3D
  • GRID_3D
  • GL_OBJECT_3D
Data model commands
  • REQUIRED_OBJECTS
  • EXPOSED_OBJECTS
  • PERSISTENT_OBJECTS
Common attrubutes
  • For all elements
  • Widgets
  • Param Widgets
  • Param Controls
  • Param Info Viewers
  • Text Widgets
  • Surface Viewers
  • Curve Viewers
  • 3D Objects
  • Parameters mapping
  • LetiMix
KUIMLElement ReferencePOPUP_MENU
March 25, 2024

POPUP_MENU

Creates a menu composed of MENU_ITEM, MENU_SEPARATOR or FILE_SELECT_MENU elements that will popup when its "Popup" action is executed.

Attributes brief detailed show all inherited

Name DescriptionDefault
Exposed Actions
Exposed: v. 2.0PopupMenu pops up at the current mouse location
Common attributesRead about `common`
idIdentifier of the elementThe id of an element has to be globally unique. Two elements cannot have the same identifierempty
Name Value type Default Description Comment
Exposed Actions
Exposed: v. 2.0Popupref_type_actionMenu pops up at the current mouse location
Common attributesRead about `common`
ididentifieremptyIdentifier of the elementThe id of an element has to be globally unique. Two elements cannot have the same identifier

Simple Menu Example

Simple popup menu with two elements that pops up when user clicks on "Click Me" text.

  1. <!-- this popup menu does nothing, just opens -->
  2. <POPUP_MENU id="menu">
  3. <MENU_ITEM name="Item1"/>
  4. <MENU_ITEM name="Item2"/>
  5. </POPUP_MENU>
  6. <!-- text to display -->
  7. <TEXT value="Click Me!">
  8. <INVISIBLE_ACTION_BUTTON action_id="menu.Popup" width="100%" height="100%"/>
  9. </TEXT>

Menu Tree

A popup menu can be composed of submenus when inserting MENU_ITEM recursively. You can also use MENU_SEPARATOR to organize your items.

  1. <POPUP_MENU id="menu">
  2. <MENU_ITEM name="Sub Menu1">
  3. <MENU_ITEM name="Sub Item 1-1"/>
  4. <MENU_ITEM name="Sub Item 1-2"/>
  5. </MENU_ITEM>
  6. <MENU_ITEM name="Sub Menu 2">
  7. <MENU_ITEM name="Sub Item 2-1"/>
  8. <MENU_ITEM name="Sub Item 2-2"/>
  9. <MENU_ITEM name="Sub Item 2-3"/>
  10. </MENU_ITEM>
  11. <MENU_SEPARATOR />
  12. <MENU_ITEM name="Item 3"/>
  13. </POPUP_MENU>
  14. <TEXT value="Click Me!" h_align="left" v_align="top">
  15. <INVISIBLE_ACTION_BUTTON action_id="menu.Popup" width="100%" height="100%"/>
  16. </TEXT>

See example of changing a param value (checked/unchecked) in MENU_ITEM.

Complex menu with actions and file selection

  1. <!-- our test param -->
  2. <PARAM id="my_color" type="enumeration" enum_values="red;green;blue" />

  3. <!-- way to make a popup menu with actions and checked_param_id -->
  4. <POPUP_MENU id="my_menu">
  5. <MENU_ITEM action_id="act_red" checked_param_id="color_is_red" />
  6. <MENU_ITEM action_id="act_green" checked_param_id="color_is_green" />
  7. <MENU_ITEM action_id="act_blue" checked_param_id="color_is_blue" />
  8. <MENU_SEPARATOR />
  9. <MENU_ITEM name="Submenu">
  10. <MENU_ITEM action_id="act_red" checked_param_id="color_is_red" />
  11. <MENU_ITEM action_id="act_green" checked_param_id="color_is_green" />
  12. <MENU_ITEM action_id="act_blue" checked_param_id="color_is_blue" />
  13. </MENU_ITEM>
  14. <MENU_SEPARATOR />
  15. <FILE_SELECT_MENU id="my_fs_menu" directories="$PLUGIN_USER_DOCUMENTS_PATH$" file_types="*.*" name="File select menu" file_path_string_id="string_out" _file_name_string_id="string_out" root_path="$PLUGIN_USER_DOCUMENTS_PATH$"/>
  16. </POPUP_MENU>

  17. <!-- actions and formula_param for the popup menu -->
  18. <ACTION id="act_red" type="Script" script="my_color = 0;" name="Set red" />
  19. <ACTION id="act_green" type="Script" script="my_color = 1;" name="Set green" />
  20. <ACTION id="act_blue" type="Script" script="my_color = 2;" name="Set blue" />
  21. <!-- these formula_params are used for MENU_ITEMs "checked" status -->
  22. <FORMULA_PARAM id="color_is_red" formula="my_color = 0" />
  23. <FORMULA_PARAM id="color_is_green" formula="my_color = 1" />
  24. <FORMULA_PARAM id="color_is_blue" formula="my_color = 2" />

  25. <TEXT value=" (POPUP_MENU) Click me! " background_color="#fad9c1" height="30">
  26. <INVISIBLE_ACTION_BUTTON action_id="my_menu.Popup" cursor="system::hand" width="100%" height="100%" />
  27. </TEXT>

  28. <!-- row of colored squares -->
  29. <ROW spacing="5">
  30. <WIDGET id="w_red" background_color="#ee4035" width="20" height="20" />
  31. <WIDGET id="w_green" background_color="#7bc043" width="20" height="20" />
  32. <WIDGET id="w_blue" background_color="#0392cf" width="20" height="20" />
  33. <PARAM_LINK from="my_color" to="w_red.opacity" formula="0.1+(x==0)" />
  34. <PARAM_LINK from="my_color" to="w_green.opacity" formula="0.1+(x==1)" />
  35. <PARAM_LINK from="my_color" to="w_blue.opacity" formula="0.1+(x==2)" />
  36. <!-- text value -->
  37. <PARAM_TEXT param_id="my_color" content="Color: {text_value} ({value})" value_format="0.0" />
  38. </ROW>

  39. <!-- action is run when param has changed -->
  40. <ACTION_TRIGGER event_id="my_color.value_changed" script=" 
  41. int val = my_color;
  42. string_out = &quot;Color changed to &quot;+my_color.text_value+&quot; (&quot;+val+&quot;)&quot;;
  43. text_string_out.opacity = 1;
  44. animate_opacity = 0;
  45.  " requires="my_color.*;string_out;animate_opacity;text_string_out.opacity" />
  46. <!-- string to show event information -->
  47. <STRING id="string_out" />
  48. <TEXT id="text_string_out" string_id="string_out" width="400" />
  49. <!-- param_animator to fade_out text -->
  50. <PARAM_ANIMATOR duration_ms="1000" id="animate_opacity" param_id="text_string_out.opacity" exposed="true" />

Simple selection menu (other way)

You may also be aware of an INVISIBLE_PARAM_MENU_BUTTON, which can create simple menus for selecting a PARAM value.

  1. <!-- our test param -->
  2. <PARAM id="my_color" type="enumeration" enum_values="red;green;blue" />

  3. <TEXT value=" (INVISIBLE_PARAM_MENU_BUTTON)" background_color="#fad9c1" height="30">
  4. <INVISIBLE_PARAM_MENU_BUTTON param_id="my_color" cursor="system::hand" width="100%" height="100%" />
  5. </TEXT>

  6. <!-- row of colored squares -->
  7. <ROW spacing="5">
  8. <WIDGET id="w_red" background_color="#ee4035" width="20" height="20" />
  9. <WIDGET id="w_green" background_color="#7bc043" width="20" height="20" />
  10. <WIDGET id="w_blue" background_color="#0392cf" width="20" height="20" />
  11. <PARAM_LINK from="my_color" to="w_red.opacity" formula="0.1+(x==0)" />
  12. <PARAM_LINK from="my_color" to="w_green.opacity" formula="0.1+(x==1)" />
  13. <PARAM_LINK from="my_color" to="w_blue.opacity" formula="0.1+(x==2)" />
  14. <!-- text value -->
  15. <PARAM_TEXT param_id="my_color" content="Color: {text_value} ({value})" value_format="0.0" />
  16. </ROW>

2020 - 2025 © Site by LetiMix  |  Plug'n Script and KUIML by Blue Cat Audio