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

Re: widgets and values



Ralf Schaa wrote:

> 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
>     ...
> -------------------------------------------------

Sybtax is wrong. Need to use

Widget_control, eve.id, SET_UVALUE='range1'
print, 'uservalue is now range1'

Using user value is not a good idea in this case because then your
buttons are no longer invoking the same actions, once their uvalues
change. Use a field in the State structure of your widget tree to keep
information of this sort.
If placing more than one command on a line, use & between them.

BTW, have you ever considered getting a book on IDL? I can recommend
David Fanning's one, see
http://www.dfanning.com/documents/books.html
Or at least browse David's web site.
Good luck,
Pavel