List box

Listbox creates a list of custom items. Similary to a combobox in functionality, listboxes can be used for much longer lists that users can scroll through. Double-clicking on a listbox item will send a channel message to Csound.

listbox align("position"), channeltype("type"), file("filename"), highlightcolour("colour"), items("item1", "item2", ...), populate("filetype", "dir"), active(val), alpha(val), bounds(x, y, width, height), caption("string"), channel("chan"), colour("colour"), fontcolour("colour"), identchannel("channel"), popup(val), rotate(radians, pivotx, pivoty), value(val), visible(val), tofront(), widgetarray("chan", number),

Specific Identifiers

align("position") Aligns the widget's text. "position" should be 'left', 'right' or 'centre'.

channeltype("type") Specifies the type of channel. Default is "float". If you wish to send the text contained in the combobox, for examples the names of a set of audio samples, set type to "string". If type is not set to string the index of the selected item will be sent to Csound on the named channel.

file("filename") Using this identifier will cause Cabbage to load lines from the given file into the combo box. If a full file path is not given, file() will search in the current directory, i.e., the directory that contains the csd file that is open. It is best to keep all files in the same directory as your csd file, but if you wish to keep them in a sperate folder you can pass a full path to the file() identifier.

highlightcolour("colour") Sets the colour of the selected text. See above for details on valid colours.

items("item1", "item2", ...) list of items that will populate the combo box. Each item has a corresponding index value. The first item when selected will send a 1, the second item a 2, the third a 3 etc. If this identifier is left out default values of "Item 1", "Item 2", "Item 3", "Item 4" and "Item 5" will be used.

populate("filetype", "dir") This will auto-populate the combobox with a set of files from a given directory. Users should specify the file type and the directory to look in. If using a combobox to recall previously recorded preset snapshots you must specify a filetype of "*.snaps". When using the populate() identifier you do not need to use the items() identifier. If no directory is specified, Cabbage will look in the current working directory. See Presets

Common Identifiers

active(val) Will deactivate a control if 0 is passed. Controls which are deactivate can still be updated from Csound.

alpha(val) A value between 0 and 1 will set the alpha blend value for the entire component. Can be useful if you need to fade widgets in and out.

bounds(x, y, width, height) integer values that set position and size on screen(in pixels).

caption("string") The string passed to caption will be the string that appears on the main application window.

channel("chan") "chan" is the name of the channel that Cabbage will communicate with Csound on. The current value of this widget can be retrieved in Csound using a chnget opcode, or can be set using a chnset opcode.

colour("colour") This sets the main colour. Any CSS or HTML colour string can be passed to this identifier. The colour identifier can also be passed an RBG, or RGBA value. All channel values must be between 0 and 255. For instance colour(0, 0, 255) will create a blue, while colour(0, 255, 0, 255) will create a green with an alpha channel set to full.

fontcolour("colour") Sets the colour of the font. In the case of slider this sets teh colour of the font in the value textbox if it is shown.

identchannel("channel") Sets the channel which data is sent and retrieved from Csound. When used with a chnset opcode users can override widget attributes. See Identifier channels

popup(val) This identifier, used with an image or groupbox will convert the plant into a popup plant. The plant will not be shown on the instrument's main interface, but will instead appear when the user sets visible to 1. < DAWs treat popup dialogue windows in different ways. As a result, you may notice inconsistent behaviour when running your instruments as plugins across a variety of different hosts.

rotate(radians, pivotx, pivoty) Rotates the widget by a number of radians(2xPI=full rotation). pivotx and pivoty will determine the rotation pivot points, where 0, 0 represents the component's top-left position.

value(val) value sets the initial state of the widget.

visible(val) A value of 0 will cause the widget to become invisible. Widgets have their visibility set to 1 by default.

tofront() Brings a widget to the front of the z order. This identifier takses no arguments and is only intended for use with identifier channels.

widgetarray("chan", number) Creates a number of widgets in a single pass. See Widget arrays

Example

<Cabbage>
form size(400, 500), caption("Untitled"), pluginID("plu1"), colour(39, 40, 34)
listbox bounds(10, 16, 300, 200), channel("comps"), file("Compositions.txt"), colour("yellow"), fontcolour("black")
</Cabbage>