Cabbage Logo
Back to Cabbage Site

Show only value on popuptext - not channel name

Hey Rory - is it possible to show only the value but not the channel name on the popup text?
cOctrmyYMs

Yes, create your own popupText() dynamically in your Csound code using cabbageSet, I think you can also override this using the popupPrefix() identifier, although I’m not 100%. Gotta rush now, might get a chance to test this later…

Thinking of making my own popup with a label that shows up above or below the mouse. Do you see any obvious caveats to doing it this way?

That should work fine, but it might be simpler to use the existing mechanisms?

Thanks Rory,

Just having some trouble understanding how to get this working with an array of controls. The docs don’t specify whether an cabbageChanged needs an array output or… Shouldn’t cabbageGetValue return the name and value of the changed channel? It seems like I need to do it twice to get one of each…

SliderChannels[] cabbageGetWidgetChannels "rslider"
Scontrol, krsliderChanged cabbageChanged SliderChannels
kRsliderVal, kvalChanged cabbageGetValue Scontrol
cabbageSet krsliderChanged, Scontrol, sprintfk("popupText(%f)", kRsliderVal)

EDIT: Solved - I had it just outside the endin block :man_facepalming:

Is there a way to remove decimal spaces from the popupvalue? Right now there’s 6 decimal spaces!

Even if I do this floor(100*kRsliderVal)/100) it still shows all the empty zeros at the end.

Also - wondering if you know what’s causing this on the hover over a control? it’s making the spectrum display above it flicker…
https://recordit.co/riPbfD4HC4

No, it only returns the index, or name of the channel that changed. I guess I was trying to follow Csound’s native changed opcode, which only notifies of the change, but doesn’t give the new value.

Use a format specifier, something like this should work:

cabbageSet kTrig, "rslider10000", sprintfk("popupText(\"%.2f\")", kSlider)

Does this only happen with the sliders that are close to the spectrogram?

Yeah. The rectangle that the popup is contained in makes that effect.

Not urgent for now. I ended up rolling my own value readout w a label widget and it looks pretty good.

1 Like

perfect, thanks!

1 Like

I’m happy you found a solution. Those kind of painting glitches can be a real pain to fix.

1 Like