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 linethickess(value), outlinethickness(value), text("caption"), popup(val), alpha(val), active(val), bounds(x, y, width, height), colour("colour"), fontcolour("colour"), identchannel("channel"), rotate(radians, pivotx, pivoty), svgfile("type", "file"), visible(val), tofront(), widgetarray("chan", number),

Specific Identifiers

linethickess(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("caption") "caption" will be the string to appear on the group box

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.

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

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.

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

  • "on" : sets the button image when it is on
  • "off" : sets the button image when it is off

For more information see Using SVGs

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 caption("Groupbox example") size(400, 300), colour(220, 220, 220), pluginID("def1")
label bounds(8, 6, 368, 20), text("Basic Usage"), fontcolour("black")
groupbox bounds(10, 34, 378, 73), text("I'm a groupbox"), colour(80, 80, 80)
groupbox bounds(8, 118, 380, 177), text("Randomly Updated Identifiers")
groupbox bounds(142, 140, 146, 145), identchannel("widgetIdent"), text("Groupbox")
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d 
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

seed 0 
;basic usage
instr 1

endin

;WIDGET_ADVANCED_USAGE

instr 2
    if metro(1) == 1 then
        event "i", "ChangeAttributes", 0, 1
    endif
endin

instr ChangeAttributes
    SIdentifier init ""
    SIdent sprintf "linethickess(%d) ", rnd(100)/80
    SIdentifier strcat SIdentifier, SIdent
    SIdent sprintf "outlinethickness(%f) ", rnd(100)/50
    SIdentifier strcat SIdentifier, SIdent
    SIdent sprintf "text(\"TextOff %f\") ", rnd(100)
    SIdentifier strcat SIdentifier, SIdent
    SIdent sprintf "alpha(%f) ", 50 + rnd(50)/50
    SIdentifier strcat SIdentifier, SIdent
    SIdent sprintf "pos(%d, 140) ", 100 + rnd(100)
    SIdentifier strcat SIdentifier, SIdent
    SIdent sprintf "size(%d, %d) ", abs(rnd(200))+40, abs(rnd(100))+50
    SIdentifier strcat SIdentifier, SIdent
    SIdent sprintf "colour(%d, %d, %d) ", rnd(255), rnd(255), rnd(255)
    SIdentifier strcat SIdentifier, SIdent  
    SIdent sprintf "fontcolour(%d, %d, %d) ", rnd(255), rnd(255), rnd(255)
    SIdentifier strcat SIdentifier, SIdent  
    SIdent sprintf "visible(%d) ", (rnd(100) > 80 ? 0 : 1)
    SIdentifier strcat SIdentifier, SIdent
    ;send identifier string to Cabbage
    chnset SIdentifier, "widgetIdent"           
endin


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