# TextBoxSlider widget

**URL:** <https://forum.juce.com/t/textboxslider-widget/296>\
**Category:** Useful Tools and Components\
**Created:** [June 19, 2005, 12:59am UTC](https://forum.juce.com/t/textboxslider-widget/296 "2005-06-19T00:59:04Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![haydxn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@haydxn](https://forum.juce.com/u/haydxn)\
**Post date:** [June 19, 2005, 12:59am UTC](https://forum.juce.com/t/textboxslider-widget/296/1 "2005-06-19T00:59:04Z")

</div>

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.h)  
[http://haydxn.net/content/JUCE/TextBoxSlider.zip](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!

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 19, 2005, 7:13am UTC](https://forum.juce.com/t/textboxslider-widget/296/2 "2005-06-19T07:13:12Z")

</div>

Sounds groovy.

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

---

<div class="post-metadata">

**Author:** ![haydxn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@haydxn](https://forum.juce.com/u/haydxn)\
**Post date:** [June 19, 2005, 12:12pm UTC](https://forum.juce.com/t/textboxslider-widget/296/3 "2005-06-19T12:12:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 19, 2005, 3:59pm UTC](https://forum.juce.com/t/textboxslider-widget/296/4 "2005-06-19T15:59:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![haydxn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@haydxn](https://forum.juce.com/u/haydxn)\
**Post date:** [June 19, 2005, 7:47pm UTC](https://forum.juce.com/t/textboxslider-widget/296/5 "2005-06-19T19:47:34Z")

</div>

😃 brilliant! 😉 8)

---

<div class="post-metadata">

**Author:** ![haydxn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@haydxn](https://forum.juce.com/u/haydxn)\
**Post date:** [June 19, 2005, 8:13pm UTC](https://forum.juce.com/t/textboxslider-widget/296/6 "2005-06-19T20:13:20Z")

</div>

Well, i’ve updated it a little so now it works properly 🙂 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. 🙂 i’m pleased with it anyway

---

<div class="post-metadata">

**Author:** ![siedschl](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@siedschl](https://forum.juce.com/u/siedschl)\
**Post date:** [November 21, 2007, 11:00am UTC](https://forum.juce.com/t/textboxslider-widget/296/7 "2007-11-21T11:00:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![werner-2](https://avatars.discourse-cdn.com/v4/letter/w/59ef9b/32.png) [@werner-2](https://forum.juce.com/u/werner-2)\
**Post date:** [November 22, 2007, 7:05pm UTC](https://forum.juce.com/t/textboxslider-widget/296/8 "2007-11-22T19:05:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [November 22, 2007, 8:09pm UTC](https://forum.juce.com/t/textboxslider-widget/296/9 "2007-11-22T20:09:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![haydxn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@haydxn](https://forum.juce.com/u/haydxn)\
**Post date:** [November 23, 2007, 12:12am UTC](https://forum.juce.com/t/textboxslider-widget/296/10 "2007-11-23T00:12:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![braindoc](https://avatars.discourse-cdn.com/v4/letter/b/b77776/32.png) [@braindoc](https://forum.juce.com/u/braindoc)\
**Post date:** [November 23, 2007, 12:20am UTC](https://forum.juce.com/t/textboxslider-widget/296/11 "2007-11-23T00:20:56Z")

</div>

> [@haydxn](#):
>
> This widget is more like just a number that you can adjust by moving vertically.

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.

---

<div class="post-metadata">

**Author:** ![siedschl](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@siedschl](https://forum.juce.com/u/siedschl)\
**Post date:** [November 23, 2007, 8:02am UTC](https://forum.juce.com/t/textboxslider-widget/296/12 "2007-11-23T08:02:56Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [November 23, 2007, 8:28am UTC](https://forum.juce.com/t/textboxslider-widget/296/13 "2007-11-23T08:28:10Z")

</div>

[http://www.anticore.org/juce/](http://www.anticore.org/juce/)

---

<div class="post-metadata">

**Author:** ![siedschl](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@siedschl](https://forum.juce.com/u/siedschl)\
**Post date:** [November 23, 2007, 10:05am UTC](https://forum.juce.com/t/textboxslider-widget/296/14 "2007-11-23T10:05:21Z")

</div>

Cool, thanks!

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 9:56am UTC](https://forum.juce.com/t/textboxslider-widget/296/15 "2017-05-12T09:56:47Z")

</div>

Closed on May 12, 2017, 9:56am UTC


