widget slider [message #5825] |
Wed, 21 February 1996 00:00  |
cabr69
Messages: 8 Registered: April 1995
|
Junior Member |
|
|
Hello All,
I am trying to use a widget slider but i can't find out how to make it
work with real numbers rather than integer; it doesn't seem to be in the IDL
manual or reference guide. Is it possible ? Does anyone know how to do it ?
I have tried simple things like ,
sliderid = widget_slider(base, max = 2.0)
^^^^
cheers,
David
|
|
|
Re: widget slider [message #5871 is a reply to message #5825] |
Wed, 28 February 1996 00:00  |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
cabr69@ccsun.strath.ac.uk ( "D.H.Brooks") wrote:
>
> Hello All,
>
> I am trying to use a widget slider but i can't find out how to make it
> work with real numbers rather than integer; it doesn't seem to be in the IDL
> manual or reference guide. Is it possible ? Does anyone know how to do it ?
>
>
One method is to use CW_FSLIDER (see the online documentation).
I don't really like it, because it makes it hard to pick a
particular value, even using the arrow keys. You also can't
adjust the "resolution" of the slider (the units of movement
which determine how quickly the values change).
What I like to do is use a normal slider widget, like the following.
If I need values from 0.0 to 2.0, I define the slider like:
lab = widget_label(parent, value = '0.00', /dynamic_resize)
wid = widget_slider(parent, minimum=0, maximum=200, /suppress, /drag)
and then when I process events from this widget I divide EVENT.VALUE
by 100 to get the floating-point value, and update the label
widget to display this value. If you change the maximum to 2000
and then divide by 1000 then you increass the resolution of
the slider.
This method works well if you don't need too much precision.
Hope this is useful.
David Foster
UCSD Brain Image Analysis Lab
foster@bial1.ucsd.edu
|
|
|