Cabbage Logo
Back to Cabbage Site

Completely invisible groupbox?

Is it possible to make a completely invisible groupbox with the contents still visible and usable? I think I need it to be a groupbox instead of a plant because the plant doesn’t respond to an identchannel for visible().

I’ve tried setting colour(0,0,0,0), fontcolour(0,0,0,0), line(0), linethickness(0), but I still get a faint border around the box that I can’t get rid of. Setting the alpha() makes the content of the box fade out too, which isn’t what I need… Just the container widget to be fully invisible.

Hello,
Yes it is possible. To see how it works in real life : have a look at the morpheur synth I uploaded few days ago.
Example thereafter shows how it works.

<Cabbage>
form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginID("def1")
groupbox bounds(80,10,200,150) visible(1) identchannel("GBox") {
    label bounds(20,20,100,18) text("Hide me")
}

image bounds(80,10,200,150) visible(0) identchannel("Image")
button bounds(5,20,60,40) channel("button") latched(1) text("hide","show")
keyboard bounds(8, 200, 381, 95)
</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d --midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

instr 2 
    if changed:k(chnget:k("button"))==1 then 
        if chnget:k("button")==1 then 
         chnset "visible(0)","GBox"
        else    
         chnset "visible(1)","GBox"
        endif
    endif
endin

;instrument will be triggered by keyboard widget
instr 1
kEnv madsr .1, .2, .6, .4
aOut vco2 p5, p4
outs aOut*kEnv, aOut*kEnv
endin

</CsInstruments>
<CsScore>
;causes Csound to run for about 7000 years...
f0 z
i 2 0 z
</CsScore>
</CsoundSynthesizer>

Sorry if this wasn’t clear… the groupbox does need to be a plant too, so that when it does get passed visible(0), all widgets within it will disappear together.

In your example, if you make that groupbox a plant, when it’s passed the trigger the label will disappear too. I need the box to be invisible and usable WHILE the contents are still visible. Essentially, I’m just trying to get rid of the sort of border/shadow that appears automatically on groupboxes.

Humm I not sure I understand.

This is what happens in the example. The label disappears when the groupbox is hidden.
If you want the content of a groupbox remain visible but make the groupbox itself disappear, it sounds a bit strange to me as a group box… is a container.

Should you want not to show a groupbox and keep all widget visible on screen, you can use an image widget and place widget at absolute coordinates on screen .

label bounds(85,30,190,12) text("Shown only when image is hidden") fontcolour("black")
image bounds(80,10,200,150) visible(1) identchannel("GBox") plant("toto") {
    label bounds(5,30,160,12) text("Hide me I am bound to the image")
}

But not sure this helps.

Bascally I want to have a groupbox logically, but not visibly.

I want it (the box itself, but not it’s contents) to be fully transparent, even when it’s visible(1).

Go back to your first example, and make the groupbox colour(0,0,0,0), fontcolour(0,0,0,0), line(0)

You’ll see there’s still a small border around it. That border is all I need to get rid of. This allows me to treat a group of widgets in the container all at once, without having to see the container itself.

Thanks for trying, hopefully that makes it as clear (ha!) as possible. :slight_smile:

Now I understand. Did you try to replace the groupbox by an image ?

If I change the alpha channel of the image color to 0, I get the same result as setting alpha(0) in the groupbox… all of the widgets contained disappear.

With this I don’t see a frame around the image :

image bounds(134, 58, 163, 110) identchannel("GBox") colour(0, 0, 0, 0) fontcolour:0(0, 0, 0, 0) fontcolour:1(0, 0, 0, 0){ 
label bounds(5, 21, 160, 8) text("Hide me I am bound to the image") 
button bounds(30, 40, 60, 28) channel("buttonchan") text("Push me", "Push me") 
}

Rory is going to kill me to put a plant into an image !!

image plant("blah") bounds(134, 58, 163, 110) identchannel("GBox") colour(0, 0, 0, 0) fontcolour:0(0, 0, 0, 0) fontcolour:1(0, 0, 0, 0){ 
label bounds(5, 21, 160, 8) text("Hide me I am bound to the image") 
button bounds(30, 40, 60, 28) channel("buttonchan") text("Push me", "Push me") 
}

Had to make it a plant… you even said something about it but didn’t make it one! :wink: But yeah, an invisible container with visible widgets with relative positions… this might be what I need! Going to have to do a test or two real quick.

Thanks for the help!

Edit: Just tried this in the full instrument, it works perfectly! I hadn’t ever thought to use an image as a container… that’s a great trick to keep in mind. Thanks again for pointing it out.

Not at all? Images and groupboxes are made for plants. Now if you were to insert a plant within a plant, well, hmm, it might well work, but do so at your own risk. It works now by accident, and not really be design! I guess someone will push it to the limits soon enough :joy:

Now that you mention it @rorywalsh (and now that I’m actually playing around with image plants as containers)…

Am I crazy, or did the behavior change between C1 and C2 regarding an image plant that is within another plant? In C1 it appears that the nested image plant has absolute pixel location values, whereas in C2 it seems that they’re relative to the plant they are nested in.

Is this true, and if so any suggestions for an easy workaround to get the same result in both versions?

Plants were never meant to be nested, even in Cabbage 1, see the emphasised note in the docs :wink: :
http://cabbageaudio.com/docs/plants/
The behaviour may indeed have changed, but it was never supported to begin with. I didn’t realise it worked in C1?

It’s not extensively tested… but it appears to work for the most part. The first image I was working with as a plant wasn’t nested, so no problems in either. I started placing more stuff into image containers, and it didn’t work right. That seems to be the only difference so far. That, and they don’t inherit the visibility of their parent either.