Cabbage Logo
Back to Cabbage Site

New moveBehind() identifier

I’ve added a new moveBehind() identifier. It takes the channel name of a widget you wish to move this widget behind. Note it should only be called from the Csound orchestra using a cabbageSet opcode.

Note that the widgets/plants you want to move have to have the same parent.


form caption("Test") size(150, 150), guiMode("queue")
image bounds(0, 0, 100, 100), colour("red"), channel("image1")
image bounds(0, 0, 100, 100), colour("yellow"), channel("image2")
-n -d -+rtmidi=NULL -M0 -m0d 
ksmps = 32

instr 1
    cabbageSet "image2", "moveBehind(\"image1\")"

;causes Csound to run for about 7000 years...
i1 0 z

Nice addition, but wouldn’t a layering system of widgets be more robust? Perhaps a optional layer()-identifier?

Also if you used plants (groups), you could maybe change layer of all the widgets inside the plant by changing the layer of the main widget? Just thinking out loud here…

How would this layer() identifier work exactly. And what could be done with it that couldn’t be done with this?

There is a toFront() identifier which will brings things to the front. That more or less covers most things if you want to bring focus to a group of widgets. The moveBehind() identifier was really only added because it is now possible to dynamically add widgets and in some case you will want to position it behind a widget that has already been created.

I was thinking layer(0), layer(1), layer(2) like in this picture:


It would allow for precise layering placement of widgets during runtime. It could also allow for widget placement infront/behind other widgets independent from the order the code is placed in the Cabbage<>-section (currently all widgets stack on top right?)

I didn’t know about the toFront()-identifier, so it seems like it mostly covers things yeah

Edit: It could also be integrated into the GUI-editor (right side of Cabbage), but again, I’m just thinking out loud about this

I think I will leave it as is for now. I’m not sure it’s worth all the extra work for such a boutique feature.

1 Like