[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

widgets and values



Hi there,

i like to have a widget doing the following:

PROBLEM1:
if the button 'range1' has been pushed, then change the UVALUE from
'range' to 'range1'
if the button 'range2' has been pushed, then change the UVALUE from
'range' to 'range2'
...
depending on the new uservalues in another program the rangings of the
plots are been set...
but for some reason it won't work, and actually i think to do it with
the UVALUE's isn't a bad idea, is it?

PROBLEM2:
when the USERVALUE's have been set,
i'd like to have a message like:"uservalue is now range1"
see the source below how i tried to do that


any suggestions? :-/

Ralf

some snipsnaps of the source:
--------------------------------------------------
PRO clus
    ...

   desc1=REPLICATE({flags:0,name:' '},4)
   desc1.flags=[1,0,0,2]
   desc1.name=['Range','range1','range2','userrange']

    ...

   but(8)  =
CW_PDMENU(pan1,desc1,UVALUE='range',/RETURN_INDEX,FONT=butfont)
...
--------------------------------------------------
PRO clus_event
    ...
WIDGET_CONTROL,eve.id,GET_UVALUE=uval
;
   CASE uval OF
 "range" : BEGIN
         CASE eve.value OF
           1 : SET_UVALUE='range1' , PRINT, 'uservalue is now range1'
           2 : SET_UVALUE='range2'
           3 : SET_UVALUE='userrange'
         ENDCASE
    ...
-------------------------------------------------
PRO plot
...
IF (UVALUE EQ 'range1') THEN BEGIN
;B_x
  index=0
   yranmax=[1024.,512.,256.,128.,64.,32.,16.,8.,4.,2.,1.]
   IF maxmag0 GT 2048. THEN yrange = [0.,2048.] ELSE BEGIN
      WHILE (yranmax(index) GE maxmag0) AND (index LT 10) DO BEGIN
   print,'yranmax',yranmax(index),maxmag0
         yrange0=[0.,yranmax(index)]
         index=index+1
      ENDWHILE
   ENDELSE
...
ENDIF