Cabbage Logo
Back to Cabbage Site

Position of text of a widget

Hi Rory,

I’m looking for a way to place the text of a widget in a specific position (on top of the widget currently), is there a shortcut or a smart way of doing it than creating a separate label for it?

It would be nice being able to set the position of the text (left, right, top, bottom), with margins too!

https://cabbageaudio.com/docs/label/#align

That do it?

I tried this and I always have the text on the left:

hslider bounds(10, 10, 250, 50) channel("band") range(0.17, 0.5, 0.5, 1, 0.001) text("FREQ SPREAD"), align("top") 

image

Oh sorry, I thought you meant label. No the sliders don’t have that option. You’ll have to create labels for them. Sorry. :pensive:

Oh no :sweat_smile:
Will you consider implementing this feature or is it out of scope?

I’m afraid the slider class is a bit of a monster. I regret the day I decided to support text labels at all :rofl: To add support for this would be a bit of a pain. But I can take a look. It won’t be until after Easter though. If you can’t wait that long you might consider generating the widgets in Csound using cabbageCreate?

I’m trying to create a sample for CsoundUnity but also to have a working Cabbage patch, so it would feel convenient to have the slider and its label all together, and still being able to position the label in a nice way to be seen on Cabbage. Of course it won’t be an issue when played on Unity, but there I cannot use cabbageCreate.
(I’m trying to rebuild the “Stria Synth” from CsoundQT Examples, since it’s one of the most impressive Csound orchestra I have ever seen - and also because it sounds partially broken there, and nobody is maintaining it I believe)

Ah, nice. And yes I see the issue. I’ll look into it :+1:

For example it would be nice to be able to control how much the slider is resized when displaying the label (without having it dependant on the label characters length):
image
Ideally I’d like to have all the sliders of the same length

And of course take your time: I will need some time to put it together, and also I won’t work on it a lot until the end of April

You could also do this using plants? The label could be part of the slider group. You would only need to update the parent’s coordinates and the label would follow?

Ah interesting! I should read more about that :wink:
Hopefully CsoundUnity will still parse it correctly

You could always add UnityIgnore definition so certain sections of Cabbage code is ignored by the CsoundUnity parser?

Apparently there’s no need, it works perfectly!


Oh great, that’s going to save me a world of pain :rofl: