Cabbage Logo
Back to Cabbage Site

Is there a way to set "tooltip" text?

Is there a way to set the popup tooltip text on widgets to something other than their channel name?

1 Like

Not currently. Are you looking to provide more detailed information on the tooltip?

Exactly. I’m working on an instrument where the visible control widgets change based on a selectable mode, and having the tooltip describe the different visible controls at the time in a more human meaningful way would be very helpful.

My specific use case for this is rsliders which already popup with the channel name, but I’d imagine a few other widgets could benefit from it too.

So you are setting different widgets visibility based on user selection. Have you thought about using the text() identifier to show the purpose of the rslider?

I considered it, but for space constraints and similarity of function of each widget, it seemed overkill to have it always visible. The effect I’m working on is a delay that works in either seconds, taps IN beats at tempo, or taps PER beat at tempo… all modes have a ā€œDelay Lā€ and ā€œDelay Rā€ labeled widget which makes sense for text(), but in each mode they work slightly differently, so more descriptive text in the popup would be very useful.

As for space constraints, text() can only a word or two… I’m hoping at least a few more would fit in the popup? :wink:

Currently you can’t do this but I can look at overriding the text that appears on the popup with a new identifier called popuptext(). I guess the value should also appear in the new popup? I tried doing it another way using identchannel()s but I don’t think it’s ideal.

tapsSeconds.csd (1.0 KB)

That’s a great question… I guess so, hadn’t thought about that. It’s typically useful to have, so I’d say keep it. If you wanted to get real crazy, you could add in an optional token to signal not display the value, like maybe ā€˜$’ (picked for representing EOL in *nix). For example popuptext(ā€œBlah blah blahā€) would display with a value and popuptext(ā€œLorem Ipsum$ā€) would not. Tho I guess since $ is used for preprocessor parsing, it might have to be escaped or doubled up or something to be used properly, so maybe a different character would be a better pick.

I might be missing something, but I don’t think your example is actually changing the popup text, is it? It seems like it’s still dependent on the channel names.

It’s not straightforward to go parsing strings like that without a bona fide parser. Cabbage uses a fairly ad-hoc parser for these things. But I think there may be another way. I’ll look into it. If the strings are being created in Csound then you could either send the value or leave it out.

That example does change the popup text. Just toggle between the two checkboxes.

What I mean is that in your example the popup text is still identical to the channel name, you’re changing which widget is visible. It technically changes what the popup text is, but isn’t really achieving my goal. I am asking to be able to have the popup text be different than both the widget channel name and text below the widget. For example, the widgets text is ā€œDelay Lā€ for all three widgets, the channel might be either DelayTL, DelayBL, DelayPBL, and the popup text would be more human for each, such as ā€œTime in secondsā€, ā€œBeats per tap at tempoā€, and ā€œTaps per beat at tempoā€.

Also, I get that the parser is simple and not very flexible, but just spitballing ideas here… you could also possibly tokenize the channel name and value. For example the default right now is equivalent to popuptext("&c: &v"), but a user could also do something like popuptext(ā€œChannel &c has a value of &vā€). The tokenizing might not be likely, but just giving you some ideas to think about.

Yup. That’s exactly what’s happening. Not a fix for your problem. Just thought I would post it anyway!

I think I will just add a new popuptext() identifier. If you wish to display the value when the users changes the slider you can do so using an identchannel and Csound code. Why spends days creating a new way of doing in Cabbage syntax when Csound can do it for us :wink:

Something like this seems to work well. I just need to run a few more text. You’ll see I’ve added the same identifier to regular widgets too in case that proves useful.

That looks like it will do exactly what I’m looking for!

I agree, if you need/want the value in there it can be put in via the sprintf statement. I wasn’t thinking that through, that approach is much simpler and more direct.

I won’t be at my OSX machine until tomorrow, but I’ll try to fire off a build for you before the weekend.

Awesome, thanks! I can wait for a build no problem… especially this doesn’t functionally change my instruments, but I think it could help us build UIs that are more user friendly to non csound/cabbage users.