Value slider's value display box size

24 views
Skip to first unread message

Vimal Parikh

unread,
Dec 22, 2016, 1:58:42 PM12/22/16
to fltk.general
I have created a value slider with following parameters:

min = 0.0
max = 1.0
step = 0.005

The slider is showing ok but the value display area (i.e. between label and slider) is not wide enough to show 4 digits (i.e. 0.000)
Is there a way to increase the size of the value display box?

Vimal Parikh

Albrecht Schlosser

unread,
Dec 23, 2016, 12:18:04 PM12/23/16
to fltkg...@googlegroups.com
No, unfortunately not. The width of the value display box is currently
hard coded with a fixed size of 35 pixels.

This is a known issue that should be improved in FLTK 1.4 and there is
STR #3222 that provides a patch for 1.3.4:
http://www.fltk.org/str.php?L3222
http://www.fltk.org/strfiles/3222/Fl_Value_Slider.patch

For now you can try if this patch can help you (it makes the value
display width user settable). It applies cleanly to FLTK 1.3.4, but I
didn't really test its behavior. It looks correct at a first glance.

Anyway: if you use it please be aware that the given API may change in
FLTK 1.4 if it is included in the library.

Advanced mode: If you don't want to patch your FLTK library you can
derive your own widget from Fl_Value_Slider and override the draw() and
maybe also the handle() method...

Karl Harbinger

unread,
Dec 31, 2016, 10:56:56 AM12/31/16
to fltk.general
Is it possible to just put the value text below the slider?

Ian MacArthur

unread,
Dec 31, 2016, 11:01:24 AM12/31/16
to fltkg...@googlegroups.com
On 31 Dec 2016, at 15:56, Karl Harbinger wrote:

Is it possible to just put the value text below the slider?


I seem to recall Greg’s cheatsheet having a few examples of things to do with displaying the value of a slider, so there may well be something there you can copy.


Probably starting with something like: http://seriss.com/people/erco/fltk/#SliderInput or http://seriss.com/people/erco/fltk/#SliderTooltip and then tweaking from there?



Vimal Parikh

unread,
Jan 3, 2017, 12:24:53 PM1/3/17
to fltk.general, Albrech...@online.de
Hi Albrecht-

I tried the patch for 1.3.4 and it works perfectly.
Thanks.

PS: the SlideInput group gadget from Greg's cheat sheet looks good too. I may try that next.

Vimal
Reply all
Reply to author
Forward
0 new messages