Ralf Schaa wrote:
>
> Cheers!
> 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....
>
> thanx for any help!
> ralf
Dear Ralf,
I have written a compound widget for Buttons,
cw_buttons
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/cw_buttons.tar.gz
e.g.
value={value:['Switch1','Switch2'],set:[0,1]}
b=cw_buttons(a,value=value,uvalue='EF',col=2,/nonexclusive,f rame=2,xoffset=20,yoffset=0,button_frame=1)
regards
Reimar
PRO test_event,ev
WIDGET_CONTROL,ev.id,get_uval=cmd
WIDGET_CONTROL,ev.top,get_uvalue=b
CASE cmd OF
'done':WIDGET_CONTROL,ev.top,/dest
'FF': BEGIN
WIDGET_CONTROL,ev.id,get_value=v
print,v.set
idx=(WHERE(v.set EQ 1,count))[0]
IF count GT 0 THEN BEGIN
value={value:[strtrim(SINDGEN(idx+1),2)],set:MAKE_ARRAY(idx+ 1,/LONG,value=1)}
WIDGET_CONTROL,b,set_value=value
ENDIF
END
ELSE:
ENDCASE
END
PRO test
a=WIDGET_BASE(row=2)
value={value:['MIN','SPEC','DEFAULT','MAX'],set:[1,0,0,0]}
b=cw_buttons(a,value=value,uvalue='FF',row=1,button_xsize=60 ,frame=2,xoffset=0,yoffset=0,button_frame=1)
value={value:['0'],set:[1]}
b=cw_buttons(a,value=value,uvalue='EF',col=2,/nonexclusive,f rame=2,xoffset=20,yoffset=0,button_frame=1)
d=WIDGET_BUTTON(a,val='done',uval='done')
WIDGET_CONTROL,/realize,a,set_uvalue=b
XMANAGER,'test',a
END
>
> ;======================
> COMMON drawbutton, draw
> draw = {onoffpanel: fltarr(4) }
> draw.onoffpanel = [0,0,0,0] <---my predefined values
>
> ;============================================
> ; defined in the main-programm
> ;============================================
> onoffpanel=CW_BGROUP(container1,['sat1','sat2','sat3','sat4' ],$
> /NONEXCLUSIVE, $
> FONT=font,/RETURN_INDEX,$
> UVALUE='onoff',SET_VALUE=draw.onoffpanel, $
> COLUMN=4,LABEL_TOP='sat-plot: ',/FRAME)
>
> ;======================================
> ; defined in the event_programm
> ;======================================
>
> WIDGET_CONTROL,Event.Id,GET_UVALUE=Ev
>
> CASE Ev OF
> 'onoff': BEGIN
> draw.onoffpanel= event.value
> CASE draw.onoffpanel(0) OF
> 0: PRINT, 'sat1:off'
> 1: PRINT, 'sat1:on'
> ENDCASE
> CASE draw.onoffpanel(1) OF
> 0: PRINT, 'sat2:off'
> 1: PRINT, 'sat2:on'
> ENDCASE
> CASE draw.onoffpanel(2) OF
> 0: PRINT, 'sat3:off'
> 1: PRINT, 'sat3:on'
> ENDCASE
> CASE draw.onoffpanel(3) OF
> 0: PRINT, 'sat4:off'
> 1: PRINT, 'sat4:on'
> ENDCASE
> ENDCASE
> ENDCASE
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg1/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
http://www.fz-juelich.de/zb/text/publikation/juel3786.html
============================================================ ======
read something about linux / windows
http://www.suse.de/de/news/hotnews/MS.html
|