Widgets
Form
form creates the main application window. The default values for size are 600x300. There can only be one form per instrument, and it has the unique channel name of MainForm. The caption property will only be displayed when running an instrument as a standalone application.
Properties
Section titled “Properties”Caption
Section titled “Caption”"caption": "string"The string passed to caption will be the string that appears on the main application window.
"id": "widgetId"This optional channel can be used to define a top-level line of communication between the instrument’s UI and Csound. It is reserved for UI updates only. If omitted, it defaults to the first id from the channels array. Its primary purpose is to help produce clearer code, especially for widgets with multiple channels.
"size": {"width":100, "height":100}integer values denoted the width and height of the form.
"style": { "fill": "#004c6b", "opacity": 1},- The form background color is controlled by
style.fill. - Opacity applies to the form’s background.
Example
Section titled “Example”<Cabbage>{ "pluginId" : "def1", "enableDevTools": true, "channelConfig" : [ {"name": "0 in 2 out", "ins": "0", "outs": "2"} ], "widgets" : [ { "type": "form", "caption": "Form Example", "size": {"width": 380, "height": 200} }, { "type" : "label", "channels": [ { "id": "info", "event": "valueChanged" } ], "bounds" : {"left": 10, "top": 16, "width": 360, "height": 20}, "label" : {"text": "The form sets this window's caption and size"} } ]}
</Cabbage><CsoundSynthesizer><CsOptions>-n -d -+rtmidi=NULL -M0 -m0d</CsOptions><CsInstruments>; Initialize the global variables.ksmps = 32nchnls = 20dbfs = 1
; Rory Walsh 2021;; License: CC0 1.0 Universal; You can copy, modify, and distribute this file,; even for commercial purposes, all without asking permission.
instr 1 prints("Form example running\n")endin
</CsInstruments><CsScore>;starts instrument 1 and runs it for a weeki1 0 z</CsScore></CsoundSynthesizer>