comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: IDL Slider Widget with discrete values

Re: IDL Slider Widget with discrete values
type: item
description: >>>> > "Jeff" == Jean-Francois Pelletier <al662@FreeNet.Carleton.CA> writes: In article <CoFCwC.LzB@freenet.carleton.ca> al662@FreeNet.Carleton.CA (Jean-Francois Pelletier) writes: Jeff> I'm trying to make a slider which would show (and retrurn of Jeff> course) the following 3 values: 25, 50, 100 and nothing else. Here is a simple compound widget hack based loosely on cw_fslider.pro that should do what you want. You may want to fix it up, but it should work. Let me know if you have any problems with it. Chris ;+ ; NAME: ; ; CW_DSLIDER ; ; PURPOSE: ; ; Provide a discrete slider widget displaying values from an ; array of strings. ; ; CATEGORY: ; ; Compound widgets. ; ; CALLING SEQUENCE: ; ; Return = CW_DSLIDER(parent) ; ; INPUTS: ; ; PARENT - The ID of the parent widget. ; ; KEYWORD PARAMETERS: ; ; DRAG - Zero if events should only be generated when the mouse ; is released. Non-zero if events should be generated ; continuously when the sliders are adjusted. Note: On slow ; systems, /DRAG performance can be inadequate. The default ; is DRAG=0. ; FRAME - Nonzero to have a frame drawn around the widget. The ; default is FRAME=0. ; TITLE - Title of slider (Default is no title). ; UVALUE - Supplies the user value for the widget. ; VALUE - Initial value of slider ; VLIST - String array of values to display for slider. ; ; OUTPUTS: ; ; The ID of the created widget is returned. ; ; SIDE EFFECTS: ; ; This widget generates event structures containing a field ; named value when its selection thumb is moved. ; ; PROCEDURE: ; ; WIDGET_CONTROL, id, SET_VALUE=value can be used to change the ; current index of the value displayed by the widget. ; ; WIDGET_CONTROL, id, GET_VALUE=var can be used to obtain the current ; index of the value displayed by the widget. ; ; ; EXAMPLE: ; ; id=cw_dslider(parent,vlist=string([0,10,100]),/drag) ; ; MODIFICATION HISTORY: ; ; Tue Apr 19 11:52:16 1994, Chris Chase S1A <chase@jackson> ; ; Created. Based loosely on cw_fslider.pro. ; ;- pro dslider_set…
creator: chase
date: 1994-04-19T16:02:30-00:00

Re: IDL Slider Widget with discrete values
type: item
description: In article <CoFCwC.LzB@freenet.carleton.ca>, al662@FreeNet.Carleton.CA (Jean-Francois Pelletier) wrote: > > > Hi, > > I'm trying to make a slider which would show (and retrurn of course) > the following 3 values: 25, 50, 100 and nothing else. > > Someone from RSI told me how to make a slider which would > only stop on these values but when I move the cursor I still > see the other numbers. I first thought it would be quite > easy to pass a vector containing the allowed values to the widget > but it ain't so. > > Any answers or hints would be very welcomed. > > Jeff The slider function is going to show the full range of integers for whatever range you define (which is what you want). To make it stop ONLY on specific values, set up some logic in your slider callback to set the slider value to the closest discrete value you want to display. For example; if the slider was moved to a value of 18, have your callback set the slider value to 25. If the slider was moved to 53, have your callback set the slider value to 50. (You get the idea.) Hope this helps. -- ************************************ mark_cadwell@qmail4.trw.sp.com Redondo Beach, CA ************************************
creator: mark_cadwell
date: 1994-04-19T17:25:06-00:00

Re: IDL Slider Widget with discrete values
type: item
description: hello, responding to the discrete slider value questions/comments. If you know you want three discrete value (for example), then set the slider from 1 to 3, and in your event handler routine, convert the 1, 2,3 to the three values you want with a little case statement. This assumes you don't want the little values displayed next to the slider. -stephen Strebel -- Stephen C Strebel / SKI TO DIE stl@maz.sma.ch / and Swiss Meteorological Institute, Zuerich / LIVE TO TELL ABOUT IT 01 256 93 85 / (and pray for snow)
creator: stl
date: 1994-04-21T14:28:41-00:00