Cabbage Logo
Back to Cabbage Site

widgetArray() is deprecated

I’m going to mark the widgetArray() identifier as deprecated. The reason being that it is no longer needed. Since Cabbage 2.5.34 you can create and manage multiple widgets directly in Csound. For example, the following code will create, position and initialise 5 nsliders1

instr CreateNSliders
    iVals [] fillarray 1,4,3,2,1
    iWidget = 0
    
    while iWidget < 5 do
        ; create bank of nslider using cabbageCreate opcode 
        SCode sprintf "nslider bounds(%d, %d, 40, 28), channel(\"check%d\"), velocity(50), range(0.5, 4, %d, 1, 0.01)", iWidget%10*40+25, 30, iWidget+1, iVals[iWidget]
        cabbageCreate SCode
        iWidget += 1
    od
endin

This code is more succinct than the older mechanism and far more robust. The widgetArray() identifier will continue to work as it has always done, and older instruments that use it will continue to work as before.

1 This code requires guiMode('queue") to be set when declaring your form.