Group Box

Groupbox creates a container for other GUI widgets. They do not communicate with Csound but can be useful for organising widgets into panels.

groupbox lineThickness(value), outlineThickness(value), text("string"), popup(val), alpha(val), active(val), bounds(x, y, width, height), colour("colour"), fontColour("colour"), channel("chan"), identChannel("channel"), imgFile("type", "file"), rotate(radians, pivotx, pivoty), parent(val), visible(val), toFront(), moveBehind("widgetName"), widgetArray("chan", number),

Specific Identifiers


lineThickness(value) Sets the thickness of the line that appears under the groupbox name. Set to 0 to disable.


outlineThickness(value) Sets the thickness of the widget's outline. Set to 0 to disable.


text("string") "string" will be the text that appears on the widget. button widgets take two strings, one for on and one for off.


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.

plant("name") [DEPRECATED] Sets the name of the plant. No two plants can have the same name. See Plants

popup(val) [DEPRECATED] If the groupbox is a plant, a value of 1 will cause the groupbox to open in a new window when show(1) is called. popup() should always be used in conjunction with the show() identifier. See Plants

show(val) [DEPRECATED] A value of 1 will cause the popup plant to show. A value of 0 will close the popup plant. See Plants

Common Identifiers


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.


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


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


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.


channel("chan") or channel("chan1", "chan2") in the case of widgets that accept two channels such as xypad, soundfiler and range widgets. channel() accepts a string/s that names the channel/s that Cabbage will communicate with Csound on. The current value of this widget can be retrieved in Csound using a chnget, or a cabbageGetValue opcode. Its value can be set using the cabbageSet, or cabbageSetValue opcodes. hrange, vrange, xypad, and soundfiler all take two channels:

hrange, vrange : channel("min", "max") - min and max values

xypad : channel("x", "y") - x and y values

soundfiler : channel("start", "length") - start time and length of user selection, in samples

Channels named should start with a letter and cannot have any white spaces. Note that all widgets should have a unique channel name.


identChannel("channel") [!!! DEPRECATED !!!] Although identifier channels still work, they are no longer supported. Please use the new guiMode("queue") system and the cabbageGet and cabbageSet opcodes instead. They are far more efficient then identifiers channel.


imgFile("type", "file") Use this identifier to set a unique .svg or .png file to be used instead of the default look and feel. "type" should be one of the following:

Buttons:
- "on" : sets the button image when it is on - "off" : sets the button image when it is off
Sliders:
- "background" : sets the slider background image - "slider" : sets the slider thumb, or in the case of a rotary slider, the inner circle. This image moves in sympathy with that the mouse as users move the slider.

For more information see Using SVGs and PNGs


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.


parent(val) This identifier is can be to set a widget's parent. It should only be used when creating widgets dynamically using the cabbageCreate opcode. See plants for more details.


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 takes no arguments and is only intended for use within the Csound orchestra. it makes no sense to call it when declaring the widget.


moveBehind("widgetName") Moves a widget directly behind another. This identifier should only ever be called from your Csound orchestra using a cabbageSet opcode.

This only works with widgets or plants that have the same parent.


widgetArray("chan", number) [!!! DEPRECATED !!!] Deprecated. Please see the section on Managing large numbers of widgets

Example

<Cabbage>
form caption("Groupbox Example") size(380, 440), guiMode("queue"), colour(2, 145, 209) pluginId("def1")
groupbox bounds(6, 8, 368, 131) channel("group1"), fontColour(220, 220, 220), outlineColour(255, 255, 255), text("ADSR Envelope")colour(0, 0, 0, 0)
rslider bounds(16, 38, 86, 90), channel("att"), range(0, 1, 0.01, 1, 0.001), text("Att.")
rslider bounds(102, 38, 86, 90), channel("dec"), range(0, 1, 0.4, 1, 0.001), text("Dec.")
rslider bounds(190, 38, 86, 90), channel("sus"), range(0, 1, 0.7, 1, 0.001), text("Sus.")
rslider bounds(278, 38, 86, 90), channel("rel"), range(0, 1, 0.8, 1, 0.001), text("Rel.")

texteditor bounds(6, 252, 368, 175) channel("infoText"), readOnly(1), wrap(1), scrollbars(1)
keyboard bounds(6, 154, 368, 80) channel("keyboard")

</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d --midi-key=4 --midi-velocity-amp=5
</CsOptions>e
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
nchnls = 2
0dbfs = 1


; Rory Walsh 2021 
;
; License: CC0 1.0 Universal
; You can copy, modify, and distribute this work, 
; even for commercial purposes, all without asking permission. 

instr 1

    SText  = "A groupbox is a basic container for other widgets. It can be part the top-level component in a group (i.e, plant), but in most case is static.\n\nIt's Z index will determine if it sits in front or behind other widgets. Therefore it should b declared before any of the widgets that fit on it\n\nIt does not send any information to Csound, but you can control aspects of a groupbox from Csound by sending identifier data to its channel."
    cabbageSet "infoText", "text", SText

endin


</CsInstruments>
<CsScore>
;starts instrument 1 and runs it for a week
i1 0 z
</CsScore>
</CsoundSynthesizer>