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

Re: several quick questions



philip aldis wrote:
> -Is the best way to find out the number of lines in a file without actually reading
> the file to spawn a unix command, if so what command? Or is there a way of doing it
> from within IDL. I'd prefer not to read the file because some of the files are very
> large. ( I've already got a copy of DDRead, and the nlines program is fine but if
> the file is very long then it takes time)

David Fanning has some excellent advice at
http://www.dfanning.com/tips/unknown_rows.html

> -I'm writing a visualisation program for displaying some ray tracing data. A C
> program that has already been written translates  ray path histories for an engine
> duct and translates them onto a flattened version of the duct, so a 2-d appreciation
> of where the rays are in real-time can be obtained. I have to animate these images.
> I could build my widget program using the cw_animate widgets but they direct output
> to their own window. The problem is that I want to display the animation inside a
> frame of the duct with some drawings, and a second animation of the end plate of the
> duct and a drawing of the duct. So, can you direct output from cw_animate into
> specific parts of draw widgets. Or would it be best just to do the pixmaps myself?

I've written some routines which allow animation without using
cw_animate. Check out
http://cimss.ssec.wisc.edu/~gumley/frame.html

> -I am still not sure about how much functionality one can put into event handlers. I
> realise that if I put too much then the program will not be spending enough time in
> the event loop then the users will be clicking buttons thinking the programs crashed
> which will then send xmanager haywire. But, if we take the example of loading in
> data - is it best to get all the data parameters then call an object method which
> loads data into self. However while all this is going on, the user could be clicking
> buttons and causing problems. Again, if I was doing an object method to load the
> data into pixmaps ready for an animation, this is also going to take a little bit of
> time, and the user could cause problems. If I have to stop the user from mucking
> around what are some good ways of telling the user that a process is going on.

Check out the help for the WIDGET_CONTROL keywords HOURGLASS and
SENSITIVE.
If an operation takes any more than a fraction (say 1/10) of a second,
you should use these keywords to desensitize all widgets and display an
hourglass, e.g.

;- User requests that data be read, so desensitize widgets and display
hourglass
WIDGET_CONTROL, EVENT.TOP, HOURGLASS=1, SENSITIVE=0

;- Read the data
RESULT = READ_MY_DATA( FILENAME )

;- Read is done, so sensitize widgets and turn off hourglass
WIDGET_CONTROL, EVENT.TOP, HOURGLASS=0, SENSITIVE=1

Of course if your operation takes more than, say, 20-30 seconds, you may
want to look into running the operation in the background using the
WIDGET_CONTROL keyword TIMER.

Cheers,
Liam.

---
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
1225 W. Dayton St., Madison WI 53706, USA
Phone (608) 265-5358, Fax (608) 262-5974
http://cimss.ssec.wisc.edu/~gumley