comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: widget_slider with odd integers
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: widget_slider with odd integers [message #31515] Mon, 22 July 2002 12:41 Go to previous message
Daniel Peduzzi is currently offline  Daniel Peduzzi
Messages: 29
Registered: June 1999
Junior Member
Thierry Savin wrote in message <3D3C4643.1080709@mit.edu>...
> Hi all,
>
>
> Does anyone know how I could create a slider widget that produces only
> odd integers ?
>


If you are on a UNIX system, you could create a slider like this:

sliderID = widget_slider(base, value=some_odd_value, /drag, event_pro='slider_event')

which will cause the "slider_event" callback to be invoked whenever the
slider is dragged.

Then in your callback:

pro slider_event, event
my_odd_value= event.value / 2 * 2 + 1
widget_control, event.id, set_value=my_odd_value
return
end


This doesn't work *quite* as nicely under Windows, since drag events are
not generated...but the value will still jump to an odd value when the
thumbnail is "dropped."

Note: be careful of the maximum slider value (for example, trying to set
a slider with a max of 100 to the value 101 will result in a value of 100.)

Dan

---------------------------------------
Daniel C. Peduzzi
peduzzi@attbi.com
---------------------------------------
[Message index]
 
Read Message
Read Message
Previous Topic: Re: unwanted color bands in image display
Next Topic: Linking multiple files...

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 15:38:23 PDT 2025

Total time taken to generate the page: 2.32294 seconds