Menus¶
Stl.Menus
Import¶
import "_IVLS/std-library/nodes/components/menus.ksp"Node: Stl.Menus¶
Uses: Init
Overview¶
Stl.Menus
Menu utility library for binding constant arrays to Kontakt UI menu controls and querying item values and labels.
- `menus.Bind` — populates a menu from a typed constant array
- `menus.StoreStrValue` — stores the display string matching a value
- `menus.find_value` — finds the index of an item by value
- `menus.str_value` — retrieves the display string of an item by value
- `menus.print_by_value` — prints an item's label to the Kontakt message area
API¶
Nodes¶
| Name | Description |
|---|---|
node Stl.Menus |
Menus component node providing menu binding macros and query functions. |
Macros¶
| Name | Description |
|---|---|
menus.Bind(#consts#, #menu_name#) |
Populates a Kontakt menu control with items from a constant array. |
menus.StoreStrValue(#str_var#, #consts#, #val#) |
Stores the display string matching a value into a string variable. |
Functions¶
| Name | Description |
|---|---|
menus.find_value(ui_id, value) -> out |
Returns the index of the first menu item whose value matches the given value. |
menus.print_by_value(ui_id, val) |
Prints the display string of the menu item matching val to the Kontakt message a... |
menus.str_value(ui_id, value) -> out_str |
Returns the display string of the first menu item whose value matches. |
Nodes¶
node Stl.Menus¶
Callbacks: Init
Menus component node providing menu binding macros and query functions.
Macros¶
menus.Bind(#consts#, #menu_name#)¶
Populates a Kontakt menu control with items from a constant array.
| Parameter | Description |
|---|---|
#consts# |
constant array supplying menu item values and display strings |
#menu_name# |
the UI menu control to populate |
menus.StoreStrValue(#str_var#, #consts#, #val#)¶
Stores the display string matching a value into a string variable.
| Parameter | Description |
|---|---|
#str_var# |
string variable to receive the matched display string |
#consts# |
constant array to search |
#val# |
integer value to match against array elements |
Side effects: | Name | Type | Purpose |
|------|------|---------|
| menus.i | integer | Shared loop counter; set to array length on early exit |
Functions¶
menus.find_value(ui_id, value) -> out¶
Returns the index of the first menu item whose value matches the given value.
| Parameter | Type | Description |
|---|---|---|
ui_id |
integer | the menu UI control to search |
value |
integer | the item value to locate |
Returns: out — zero-based index of the matching item, or -1 if not found
Side effects: | Name | Type | Purpose |
|------|------|---------|
| i | integer | Loop counter declared locally for iteration |
menus.print_by_value(ui_id, val)¶
Prints the display string of the menu item matching val to the Kontakt message area.
| Parameter | Type | Description |
|---|---|---|
ui_id |
integer | the menu UI control to search |
val |
integer | the item value whose label to print |
Side effects: | Name | Type | Purpose |
|------|------|---------|
| @m | string | Temporary variable holding the retrieved menu label |
menus.str_value(ui_id, value) -> out_str¶
Returns the display string of the first menu item whose value matches.
| Parameter | Type | Description |
|---|---|---|
ui_id |
integer | the menu UI control to search |
value |
integer | the item value to locate |
Returns: out_str — display string of the matching item, or "Menu item not found!"
Side effects: | Name | Type | Purpose |
|------|------|---------|
| i | integer | Loop counter declared locally for iteration |
Example¶
// TODO: Add usage example