MultiButton

In addition to the two attributes listed here, MultiButton has all the same attributes as the Button widget. The available width and height for the MultiButton is divided amongst the individual buttons it is comprised of. For example, if a MultiButton has a width of .8 and four columns, each button will be .2 in width.

When outputting OSC each individual button adds it’s own number to the MultiButton OSC address when it outputs a value. For example, if the MultiButton ¬†address is “/multi” then the address for button 3 in the MultiButton would be ¬†“/multi/3”. For MIDI, the base note or control change number is augmented by the button number. If you had a MultiButton with four rows and four columns and specified the MIDI note number to be 10, the first button would output note #10, the second would output note #11 and the 16th would output #26.

For scripting purposes, it’s important to note that the MultiButton is not a single widget… it’s actually a collection of Button widgets. When you define an event handler for the MultiButton (or MultiSlider) it’s actually passed to every Button in the MultiButton. So if you refer to “this” in your event handler, that actually refers to the Button that was pressed, -NOT- the MultiButton. You can always refer to the MultiButton widget directly by name in event handlers.

Additional JSON Attributes

  • rows – The number of rows the grid of buttons will possess. The default value is 2
  • columns – The number of columns the grid of buttons will possess. The default value is 2

Scripting
Properties

  • children – a one dimensional array that holds all the child buttons. Buttons are accessed moving from left to right, top to bottom. So, in a 4×4 multibutton button #4 would be the 1st button second row (remember arrays are zero-indexed).This property was renamed from buttons in v1.1
  • childID – This is actually a property given to every Button in the children array, and identifies each button with a unique number.
  • shouldLabel – If set to true, each button will have its childID displayed at its center point. The default is false.

Simple JSON

{
     "name" : "myButton",
     "type" : "MultiButton",
     "x" : 0, "y" : 0,
     "width" : .99, "height" : .8,
     "rows" : 4, "columns" : 4,
}

Scripting
The event handler added below outputs two numbers via OSC: the button that was pressed and the value of the button.

{
     "name" : "myButton",
     "type" : "MultiButton",
     "bounds": [0,0,.5,.5],
     "ontouchstart": "oscManager.sendOSC('/button', 'ii', this.childID, this.value)",
}
This work is licensed under GPL - 2009 | Powered by Wordpress using a heavily modified version of the theme aav1