Cabbage Logo
Back to Cabbage Site

Little GUI widget slugs and wishes

Possible, but a little bit of a pain. Just so we’re clear you want to restrict the amount that someone has to move the mouse in order to move from min to max?

I’ll take a look. Newline support was added before the GUI editor. I’m pretty sure splitting a widget declaration across various lines will causes issues if you then click on the widget in the GUI editor?

You’re right. Now that I tried, I realized that I came across this in the past, so maybe I should just avoid splitting lines.

No I meant something quite different. Would need to animate it here, but let me try with words and pictures. Here I have zero at 12 o’clock (range from -1 to 1):

I’d like the following to show the green stripe from 12 o’clock to 9 instead of from 7 to 9.
So the stripe would go from START to current position, where START is a widget parameter. In this case I’d like START = 0.

vslider seems to have the behaviour I was looking for in rslider

vslider bounds(8, 10, 108, 248) range(-1, 2, 0, 1, 0.001) channel("slider")

But see what happens here when I slightly move it from 0.

I know what you mean. This might be tricky. I can take a look. So a new identifier called trackerStart() I think the simplest thing here would be to pass a value between 0 and 1. The default behaviour would be trackerStart(0), which will cause the tracker line to be drawn from min value.

Even though this is default behaviour for vslider's, I’m hesitant to override the existing behaviour for rslider's as it will once again change a lot of existing GUIs.

Of course breaking old stuff is no good. But I appreciate if you can consider adding something like the trackerStart if possible.

1 Like

Following on this, I can add an image in the background manually but I’m wondering if there is a way to put it in the background with cabbageCreate?

And another question on this: what does mouseInteraction parameter do? I don’t find it in the docs. Is it to prevent sending 1 and 0 to the channel on mouse clicks?

Please let me know when you have the time to check also:

And just a reminder, not sure you noticed:

Maybe there is a bug with tracker in vslider?

I thought I could get rid of the dot in the upper left corner for small sliders by having an image with an outline. But there seems to be something wrong with this or am I doing something wrong?
The result of this:

image bounds(200, 40, 40, 40) shape("circle")  channel("image1")  colour(255, 255, 0, 200) 
image bounds(250, 40, 40, 40) shape("circle")  channel("image2")  colour(255, 255, 0, 200) outlineThickness(5) outlineColour(255,0,0)
image bounds(300, 40, 40, 40) shape("circle")  channel("image3")  colour(255, 255, 0, 200) outlineThickness(10) outlineColour(255,0,0)


Sorry for piling up at the moment!

If I have markerStart on rslider and I move the widget with a mouse, markerStart disappears.

I guess this goes along my preference of moving the widgets by mouse rather than using cabbageCreate. At least for less grid-like interfaces (with varying widget sizes and types), mouse positioning seems quite a necessity.

That’s gone in the latest beta build. I nuked it as soon as I saw it.

I’m already ahead of you here. I am in the process of adding a way of moving the z-order to widgets. I think this is going to be necessary if one mixes the creation of widgets between the Cabbage section and the Csound orchestra.

It disables mouse interaction so that a widget under this widget can receive mouse presses. Sorry, I’ve updated the docs, I didn’t realise it was missing :wink:

Could be. The v and h sliders don’t get used much these days. I’ll take a look when I get a chance.

Thanks for all these fixes!

See outlineThickness … Another low-priority slug? Or intentional?

Fixed. New build triggered :wink: But be careful you don’t use odd numbers for outlines. It will not line up right.

Screen Shot 2021-07-08 at 19.20.31

Super! Thanks!

This fix apparently scrambled something else.
See the result of

image bounds(10, 102, 373, 58) corners(5) colour(30, 30, 30, 255) outlineColour(255, 255, 255, 100) outlineThickness(2) channel("image100")
image bounds(10, 166, 373, 58) corners(5) colour(30, 30, 30, 255) outlineColour(255, 0, 0, 100) outlineThickness(2) channel("image101")
image bounds(10, 166, 373, 58) corners(5) colour(255, 100, 0, 30) outlineColour(255, 0, 0, 100) outlineThickness(2) channel("image102")

in build #20210708.3 Merge branch ‘develop’ of into develop (left) and #20210708.4 fixing outlineThickess issue for image widget (right)

There is some transparency change and
note also the line thickness change.

No stress if you don’t manage over the weekend :wink: I’ll make use of an older build for now, because I hardly see my widgets now (transparency issue).

Yup, I definitely screwed something up. Sorry, I’ll try to get that sorted asap…

I pushed for a fix for this now. Latest Azure build should have it. Apologies for screwing this one up :grimacing: It looks normal now:

Screen Shot 2021-07-09 at 19.25.36

I’m not entirely happy with the drawing. I might try using a path for these widgets in the future. And I also noticed a long standing ‘bug’ if you could call it that. But the outline of the rectangle is drawn over the underlying rectangle. So the outline colour may be affected by the underlying rectangle colour depending on the alpha blend. I can’t imagine that’s useful for anyone :thinking:

1 Like

You’re incredible! Thank you for so fast fixing! It is so exciting to see Cabbage getting better and better day by day, hour by hour! :smiley: Well, I guess some little steps backwards sometimes are inevitable on a real journey :wink:

I’m sorry to return to this with a fresh new issue. The last fixes gave birth to a “fantastic” new little Cabbage destroyer! It has to do with checkbox and trighold that I use to blink a “light indicator”.

The code below used to work before. Now it is (1) blinking kind of randomly and it seems to mess with the form, because (2) it doesn’t stop blinking after I turn the instrument off, and (3) it also causes rslider to jump around (you get that when you move the slider to some sweet spots).

Please try running this simple example:

form caption("Test") size(350, 200), colour(0,0,0), guiMode("queue"), pluginId("sfi1")
rslider bounds(10, 10, 140, 110) range(0, 100, 0, 0.5, 0.0001) channel("slider1") colour(200, 200, 200, 255) trackerColour(200, 255, 200, 255) markerColour(0, 0, 0, 255) popupText("0")
checkbox bounds(150, 24,   20,   20), colour:0(255, 255, 0, 150), colour:1(255, 255, 0, 255) channel("blinkCheckBox"),  value(0), shape("ellipse"), active(0) automatable(0)

-n -d -+rtmidi=NULL -M0 -m0d ;--midi-key-cps=4 --midi-velocity-amp=5
ksmps = 32
instr 1
kMetro = metro:k(cabbageGetValue:k("slider1"))
cabbageSetValue "blinkCheckBox", trighold:k(kMetro,1/ksmps) ; blink

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

[edit] I actually had to go back to 2.7.5 to get rid of it, haven’t tried 2.7.6.

For now I can solve this by using cabbageSet on an image within a special devoted triggered instrument, but it seems a less elegant solution to blinking lights. I’d also be interested in any comments/suggestions on this.

This should be fixed now. I just triggered a new build. It was a recursive loop in the checkbox widget, but honestly, I can’t see how this worked in earlier versions. The last change made to the checkbox class was in April. :thinking: Can you test the latest build?

I’m glad you found the bugger and will test soon when it builds. I’m quite regularly updating beta versions last few months and I tested today with 2.7.5. Strange indeed. Hopefully there was not another recursive loop spinning in the opposite direction so they cancelled each other :grin:

1 Like

Now it works. Thank you!!!