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

Re: General purpose structure editor?





David Fanning wrote:

> Dyer Lytle (dyer@lpl.arizona.edu) writes:
>
> > Does anyone know if there exists IDL code anywhere
> > for a general purpose, widget-based, IDL structure
> > editor that will display the tags and values in
> > a text field and allow the user to edit them and
> > save back to the structure?  It should also descend
> > into arrays and pointers to substructures, etc.
> >
> > (I am trying to avoid writing this myself although
> >  it will be an interesting project.)
>
> Here's a piece of advice, Dyer. Do this on your
> own time with the PC at home and don't touch the
> University's computers. Then, when you have it done,
> call me first before you show it to anyone else.
> I've got a feeling you are not the only one who
> wants one of these. :-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.

============
Well well.

Seems its been done.  The idl routine XVAREDIT  is one of rsi's best
kept secrets.
(See my comments of Jan 15th on why rsi needs to make a greater effort
on developing library widgets for its users, and make a greater effort
to provide documentation guidance and examples of their use).

I prefer XVAREDIT from idl 4.0, but be warned, rsi techs say it has a
reported bug (altho I havnt found it).

XVARDEDIT from idl5.x is a totally rewritten routine, which to me gives
a widget which is less pleasing to the eye, and clunky to use (needs
press Enter to make an edittable field active, and press Enter to
confirm the editted field, wheras the old version is just like a
wordprocessor to use when editting fields.

Both routines work on structures, including structures containing
arrays. Pointers - I dont think so but check the doc.

The following code illustrates useage.

;
; program to demonstrate use of XVAREDIT for editting mixed string and
;         real numbers, in a widget
; this works in idl 5.x, but note the edit process on each cell of the
widget
;      requires a double click to "activate" the cell, and a Press Enter

;       to confirm changes to the cell.
; This program works more cleanly and more intuitively with the
different
;      procedure (of the same name)  XVAREDIT  in IDL 4.x
;      (in directory \rsi\idl40\lib).
;
;  demo by Michael Asten, Monash University, Melbourne.  9 Jan 99.
;
 x=10.*indgen(5*36)
y=sin(x*!pi/180)
plot,x,y
xmin=0 & xmax=(5*360) & ymin=-1. & ymax=1.
title='XVAR TEST'
print,title,xmin,xmax,ymin,ymax
; now set up a structure to pass plot parameters to an edit widget
plot_par={plot_title:title,Xaxis_left_limit:xmin,Xaxis_right_limit:xmax,
$
                      Yaxis_lower_limit:ymin,Yaxis_top_limit:ymax}
xvaredit,plot_par                ;  edit the parameters in a widget
title=plot_par.plot_title        ; now extract the editted parameters
from the structure
xmin=plot_par.Xaxis_left_limit
xmax=plot_par.Xaxis_right_limit
ymin=plot_par.Yaxis_lower_limit
ymax=plot_par.Yaxis_top_limit

print,title,xmin,xmax,ymin,ymax ; print the new values
plot,x,y,title=title,xrange=[xmin,xmax],yrange=[ymin,ymax] ; draw the
new plot
end

============