Cabbage Logo
Back to Cabbage Site

Little GUI widget slugs and wishes

It seems I’m not able to cabbageSet outlineThickness and outlineColour on buttons. See example below:

<Cabbage> bounds(0, 0, 0, 0)
form caption("Untitled") size(400, 200), guiMode("queue"), colour(0,0,0) pluginId("def1")

button bounds(30, 16, 80, 26) channel("slider1") text("A") colour:0(100,100,0,255) colour:1(255,255,0,255) fontColour:1(0,0,0,255) ;outlineColour(255, 0, 0, 255) outlineThickness(10)

</Cabbage>
<CsoundSynthesizer>
<CsOptions>
-n -d -+rtmidi=NULL -M0 -m0d ;--midi-key-cps=4 --midi-velocity-amp=5
</CsOptions>
<CsInstruments>
; Initialize the global variables. 
ksmps = 32
;nchnls = 2
0dbfs = 1
instr 1
;cabbageSet "slider1", "colour:0(255,100,0,255)"
cabbageSet "slider1", "outlineColour(255, 0, 0, 255) outlineThickness(10)"
;cabbageSet "slider1", "text(\"X\")"

endin

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

Thanks, I’ll take a look :+1:

I just pushed a fix for this :+1:

Great! Thanks!

There is one thing that bothers me and I’m not sure there is something I can do or it is in the Cabbage “seed”.

If I set button border in an instrument:
cabbageSet "slider1", "outlineColour(255, 0, 0, 255) outlineThickness(3)"

and have a slider widget like this without transparency:
button bounds(30, 16, 80, 26) channel("slider1") text("A") colour:0(50, 50, 0, 255) colour:1(255,255,0,255) fontColour:1(0,0,0,255)

it works fine,

but if I have transparency:
;button bounds(30, 16, 80, 26) channel(“slider1”) text(“A”) colour:0(255, 255, 0, 50) colour:1(255,255,0,255) fontColour:1(0,0,0,255)

the border paints the entire button.

Shall I just avoid using transparency?

This is an issue that @hdale94 also pointed out some time ago, and I’ve been meaning to fix it for ages. The problem is that I paint the entire background with the border colour, and then the main button with the main colour. So if the main button is transparent, the border colour becomes the main colour. Anyway, the solution is to use paths for drawing the components. I will try to get around to this in the next few days :+1:

Hi Rory, I’m back with a little one - behaviour of button outline and a question about commenting out widgets.

It seems that transparency can’t be used for outlineColour to function properly - in version 2.8.114?

This one works:

form caption("Untitled") size(800, 600), guiMode("queue"), colour(0,0,0) pluginId("def1")
button bounds(60, 130, 80, 26) channel("b1") colour:0(50, 50, 0, 255) colour:1(255,255,0,255) outlineColour(0, 0, 255, 255) outlineThickness(2)

but this one not:

form caption("Untitled") size(800, 600), guiMode("queue"), colour(0,0,0) pluginId("def1")
button bounds(60, 130, 80, 26) channel("b1") colour:0(255, 255, 0, 50) colour:1(255,255,0,255) fontColour:1(0,0,0,255) outlineColour(0, 0, 255, 255) outlineThickness(2)

By the way I was surprised about the strange behaviour of using // for comments instead of ; Maybe // is not supported in the widget section? It does work in most cases, but here is one example where it messes up things:

form caption("Untitled") size(800, 600), guiMode("queue"), colour(0,0,0) pluginId("def1")
//button bounds(60, 130, 80, 26) channel("abc1") colour:0(50, 50, 0, 255) colour:1(255,255,0,255) outlineColour(0, 0, 255, 255) outlineThickness(2)
button bounds(60, 130, 80, 26) channel("abc1") colour:0(255, 255, 0, 50) colour:1(255,255,0,255) fontColour:1(0,0,0,255) outlineColour(0, 0, 255, 255) outlineThickness(2)

You can notice that if the same channel names are used like in the example above, the // comment disables the button to be latched, while using ; for the comment works fine.

[edit] I just noticed that we had the related discussion already some time ago. Sorry for posting again. Anyway it would be interesting to hear about the updates and your feedback on the mystery about using // for comments.

Hi @Samo, apologies for the delay in replying. I don’t think I ever got around to fixing the transparency issue with buttons. I will try to address that this week. As for comments, I’ll take a look through the source and see what’s what but I don’t think //s are supported in the Cabbage section.

I just fixed the outline colour issue, there is a new build underway. Also, I checked, and the Cabbage section doesn’t support //, using them can cause issues with the parser, so best use the Csound style ; instead.

Thank you very much for the quick fix and reply - as always!