TextBoxSlider widget

Okay, i made this to combat the GUI restrictions i face when trying to save space yet maintain a large number of editable fields.

here’s a link to the file - it’s just a single header so it’s a snap to include in any projects you may have. Just think of it as a slider that works as a label (or vice versa) and you’ve got it.

[ZIP just holds ‘.h’ file, nothing more - i posted both just for fun]
http://haydxn.net/content/JUCE/TextBoxSlider.h
http://haydxn.net/content/JUCE/TextBoxSlider.zip

This widget should come in handy for various things. I’ve just gotten it working, and it behaves exactly like the similar controls in energyXT; your numerical parameter display acts as a slider when you drag it. So you have a number on the screen, and if you want to make it bigger, you simply click and drag upwards, or downwards to decrease the value. You can also double-click the parameter to edit it via typed entry.

I’ve not done any checking or refining on it yet - i’ve just gotten it working and wanted to post it to see if anyone was interested!

as far as interface stuff goes, it’s derived from JUCE::Label so all the display/formatting guff is exactly the same. Other things like setValue and whatnot are stolen from the JUCE::Slider class. Currently it’s fixed to velocityBased and vertical control behaviour.

EDIT: Note that this also was made before i started to properly look at the Label behaviour, so there are a number of ways it could be improved! I’ll post any changes.

EDIT2: Also, i’ve not looked fully into the way that the slider mechanism itself works - you can see i’ve just copy/pasted the necessary parts! i’ll get this stuff improved v. soon!

Sounds groovy.

I suppose I should really have an option for that sort of behaviour in the slider class itself, shouldn’t I…

well i thought of asking, but that wouldn’t be any fun now would it? :wink:

well sorry to spoil your fun, but I’ll probably add one of those in the next release!

:smiley: brilliant! :wink: 8)

Well, i’ve updated it a little so now it works properly :slight_smile: and it’s not too messy.

To use it, just add:

to your code (if it’s in the same source folder) and create a TextBoxSlider just as you would any Slider object. Dragging works properly on it now, as does the behaviour when it loses focus. The mouse wheel will also increment/decrement the value on the control. :slight_smile: i’m pleased with it anyway

So what happened to this beauty? Has it been integrated somewhere? I don’t see it, but that doesn’t say much…

Hi haydxn,

I 'm not able to download your TextBoxSlider.h file. All I get is the smiling-girl and the sponsored links. What am I doing wrong??

Another question: I heard that you made a tutorial for Juce. I’m very interested to get it, even when it’s not in sync with the new Juce version. Can you send me a link?

This was integrated into the normal slider - it’s one of the style options.

i don’t think it actually was - there’s LinearBar but that’s not quite the same - it’s horizontal and it’s got a slidery background to it. This widget is more like just a number that you can adjust by moving vertically.

I’d upload the old file if i had some reliable space, but for now i’m still without! I’ll see what i can do tho

aha, interesting. i once made exactly the same thing myself (and called the class DraggableNumber). i find this kind of widget particularly useful for modulation matrices. …and of course, everywhere where we have to be stingy with screen estate.

Exactly… you can use LinearBar for this to some extent (just overwrite drawLinearSlider in LookAndFeel to get rid of the slidery background) but to change the behaviour from horizontal to vertical requires more work, me thinks. Also I didn’t manage to make it editing-after-double-clicking-only. Somehow it always switches editOnSingleClick back on.

haydxn, if you need webspace, just send me the files, I would have no problem hosting them!

http://www.anticore.org/juce/

Cool, thanks!