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

Home » Public Forums » archive » Re: CW_BGROUP and NONEXCLUSIVE
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: CW_BGROUP and NONEXCLUSIVE [message #28137] Mon, 26 November 2001 04:12 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
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
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Trying to contact David Foster
Next Topic: Memory management on the Mac

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

Current Time: Fri Oct 10 04:56:24 PDT 2025

Total time taken to generate the page: 0.71601 seconds