Labels can be used for placing text on-screen.

label align("position"), corners(val), active(val), alpha(val), bounds(x, y, width, height), channel("chan"), colour("colour"), fontcolour("colour"), identchannel("channel"), rotate(radians, pivotx, pivoty), visible(val), tofront(), widgetarray("chan", number),

Specific Identifiers

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

corners(val) Sets the radius size of the widget's corners.

fontstyle("style") Sets the style of the font. Valid styles are, "plain", "bold"(default), "bold italic", "italic", "underlined", "bold underlined", "italic underlined" and "bold italic underlined".

text("text") "text" will be the string to appear on the label

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).

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

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.

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


form caption("Label Example") size(400, 300), colour(220, 220, 220), pluginID("def1")
label bounds(8, 6, 368, 20), text("Basic Usage"), fontcolour("black")
groupbox bounds(8, 110, 380, 177), text("Randomly Updated Identifiers")
label bounds(50, 38, 300, 18), channel("label1"), colour(20, 20, 20), text("Label. Click to send info to Csound")
label bounds(110, 140, 165, 62) identchannel("widgetIdent")
-n -d -+rtmidi=NULL -M0 -m0d 
; Initialize the global variables. 
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

seed 0 
;basic usage
instr 1 
    aTone oscili chnget:k("label1"), 300
    outs aTone, aTone    


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

instr ChangeAttributes
    SIdentifier init ""
    iChoice = rnd(300)
    if iChoice > 0 && iChoice < 0 then
    SIdentifier strcat SIdentifier, "align(\"left\") "
    elseif iChoice > 100 && iChoice < 200 then
    SIdentifier strcat SIdentifier, "align(\"centre\") "
    SIdentifier strcat SIdentifier, "align(\"right\") "
    SIdent sprintf "corners(%d) ", rnd(100)/80
    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"           

;causes Csound to run for about 7000 years...
f0 z
;starts instrument 1 and runs it for a week
i1 0 z
i2 0 z