Re: CW_BGROUP and NONEXCLUSIVE [message #28144 is a reply to message #28142] |
Sat, 24 November 2001 06:55   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Ralf Schaa (schaa@geo.uni-koeln.de) writes:
> I have this little problem with CW_BGROUP and the parameter /NONEXCLUSIVE:
> as far as i know the buttons can have two values (on=1, and off=0) , so how
> can i tell my program, that if when the status of the button is 'on' that he
> does something (for testing: print, 'on' and otherwise print, 'off') ..see
> the source below how i tried to solve it..seems logical to me, but it
> doesn't work....
I don't use CW_BGROUP, so I can't really help you with
how that works, but I think most of your problem lies
in this part of your code:
> CASE Ev OF
> 'onoff': BEGIN
> draw.onoffpanel= event.value
That last statement is effectively turning
all of your buttons ON or all of your buttons OFF,
based on the value from a single button. The problem
you have is that you don't know which button that
was.
IDL> draw = {onoffpanel: fltarr(4) }
IDL> print, draw.onoffpanel
0.000000 0.000000 0.000000 0.000000
IDL> draw.onoffpanel = 1
IDL> print, draw.onoffpanel
1.00000 1.00000 1.00000 1.00000
You probably want to know which button was selected,
so you can change the proper value in your onoffpanel
field. Maybe something like this:
Widget_Control, event.id, Get_Value=buttonValue
CASE buttonValue OF
'Sat1': draw.onoffpanel[0] = event.value
'Sat2': draw.onoffpanel[1] = event.value
'Sat3': draw.onoffpanel[2] = event.value
'Sat4': draw.onoffpanel[3] = event.value
ENDCASE
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|