Add support for property menus in Pd #77
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the functions
_properties_add
,_properties_newframe
,_properties_addcheckbox
,_properties_addtextinput
, and_properties_addcolorpicker
topd
.It also reserves the
properties
method to be executed when the user clicks on "Properties" in Pd. Property menus can be defined as shown in the example below:New
self
functionsself:newframe
Creates a new container.
arg1
: Title of the container.arg2
: Number of columns in the container.The
self:add...
methods add GUI elements to the last created container.self:addcheckbox
Adds a checkbox.
arg1
: Title of the checkbox.arg2
: Method to be executed when the checkbox state changes. This method receives a table as an argument, containing the value1
when checked and0
when unchecked.arg3
: Initial value (1
for checked,0
for unchecked).Example of a method triggered on state change:
self:addtextinput
Adds a text input field.
arg1
: Title of the text input.arg2
: Method to be executed when the value changes. This method receives a table containing a list of arguments following the Pd convention. For example, the inputhello world 1 2 3
will be split into five items, one for each atom.arg3
: Initial value, which can be a string or a number.self:addcolorpicker
Adds a color picker.
arg1
: Title of the color picker.arg2
: Method to be executed when the color changes. This method receives a table containing another table with thergb
values.Example of a method triggered on color change:
Examples
This example is inside
pdlua/tutorial/examples/properties-help.pd
output.mp4