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

Home » Public Forums » archive » widgets and values
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
widgets and values [message #25943] Fri, 27 July 2001 13:35 Go to next message
Ralf Schaa is currently offline  Ralf Schaa
Messages: 37
Registered: June 2001
Member
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=butfo nt)
...
--------------------------------------------------
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
Re: widgets and values [message #26068 is a reply to message #25943] Mon, 30 July 2001 14:14 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Overlaying filled contour plots
Next Topic: How to organize client-server IDL application?

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

Current Time: Sat Nov 29 12:38:48 PST 2025

Total time taken to generate the page: 0.07950 seconds