[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Widget Event Handling Problem
- Subject: Re: Widget Event Handling Problem
- From: davidf(at)dfanning.com (David Fanning)
- Date: Mon, 12 Apr 1999 20:13:19 -0600
- Newsgroups: comp.lang.idl-pvwave
- Organization: Fanning Software Consulting
- References: <36EC3C62.39CE88A0@scolley.freeserve.co.uk> <MPG.email@example.com>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:14322
I wrote earlier today in response to this question from Jason Brookes:
> > While I'm at it, is there an elegant way of updating the maximum value
> >for a floating-point slider ?
> No, no elegant way without hacking the code.
I was thinking about using this as a good example for why you
might want to write compound widgets as objects and I was thinking
about coding it up as an example for the newsgroup. But in examining
the code, I realized that the author of CW_FSLIDER had already
anticipated someone wanting to change the MIN and MAX values.
Unfortunately, his method has never made it into the documentation.
(Oh, don't even start!)
But as it happens, if you want to change the MIN or MAX values
you can do it like this:
Widget_Control, floatingSlider, Set_Value=[newValue, newMin, newMax]
You can also get the current MIN and MAX of the floating slider
by calling the FSLIDER_GET_VALUE function directly (I.e., don't
use the normal WIDGET_CONTROL, floatingSlider, GET_VALUE=thisVal
syntax), like this:
min_max = FSLIDER_GET_VALUE(floatingSlider, /MinMax)
This is VERY non-standard compound widget coding, but typical
of many RSI-supplied routines. Of course, you can get away
with it if you understand what you are doing and I have to
admit that as hard as it is to understand their code most
of the time, the RSI programmers DO know what they are
Anyway, all of this information is in the header of the
CW_FSLIDER program and you can read it for yourself. Perhaps
it will make it into the IDL documentation in IDL 5.3.
P.S. I also got a nice "hack" from my friend Andrew Cool
in Australia. His "Discrete_Slider" code is a floating
slider than can change it's value in discrete units. I have
his permission to put it on my web page if anyone is interested.
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: firstname.lastname@example.org
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155