{ "source": "JSON", "data": "BLOCK", "version": "0.0.1", "type": "javascript.form.select", "language": "javascript", "extension": "webaudio", "help": "Select", "label": "Select", "color": "#F92317", "group": "Form", "codes": [ { "name": "declaration", "code": "\n// block_$id$ = $label$\nvar $port[str_value]$ = [];\nvar $port[float_value]$ = [];\n" }, { "name": "function", "code": "\nfunction populateCombo(combo, text_values){\n var values = text_values.split(',');\n for (var i = 0 ; i < values.length ; i++){\n var c = document.createElement(\"option\");\n c.text = values[i];\n combo.options.add(c, combo.options.length);\n }\n }\n" }, { "name": "onload", "code": "populateCombo(document.getElementById('block_$id$'), '$prop[values]$');" }, { "name": "execution", "code": "\nfunction change$id$(){\n el = document.getElementById(\"block_$id$\");\n value = el.options[el.selectedIndex].value;\n for (var i = 0; i < $port[str_value]$.length ; i++){\n $port[str_value]$[i](value);\n }\n for (var i = 0; i < $port[float_value]$.length ; i++){\n $port[float_value]$[i](el.selectedIndex);\n }\n};\n" }, { "name": "html", "code": "\n$prop[label]$
\n" } ], "properties": [ { "name": "label", "label": "Label", "type": "String", "value": "Label" }, { "name": "values", "label": "Values", "type": "String", "value": "values" } ], "ports": [ { "conn_type": "output", "name": "str_value", "label": "String Value", "type": "javascript.string" }, { "conn_type": "output", "name": "float_value", "label": "Float Value", "type": "javascript.float" } ] }