Add support for property menus in Pd #77
Draft
+611
−0
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_addcolorpickertopd.It also reserves the
propertiesmethod to be executed when the user clicks on "Properties" in Pd. Property menus can be defined as shown in the example below:New
selffunctionsself:newframeCreates 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:addcheckboxAdds 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 value1when checked and0when unchecked.arg3: Initial value (1for checked,0for unchecked).Example of a method triggered on state change:
self:addtextinputAdds 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 3will be split into five items, one for each atom.arg3: Initial value, which can be a string or a number.self:addcolorpickerAdds 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 thergbvalues.Example of a method triggered on color change:
Examples
This example is inside
pdlua/tutorial/examples/properties-help.pdoutput.mp4