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

Home » Public Forums » archive » Re: several quick questions
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
Re: several quick questions [message #13193] Sat, 24 October 1998 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Philip Aldis (teal@dera.gov.uk) writes:

> -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'll just add a bit to Liam's useful advice. If you still have
the files from your programming course, look at the file XMOVIE.PRO.
That is an example of how you can do an animation correctly
into any draw widget you like. (The file is on my web page, too.)

> - If I am building a widget application, but wish to do all my actual processes
> using objects - which contain data and methods - then is it best to program the
> widgets as normal - functionally - then create my objects in the widget program and
> use the methods on the objects.

Yes. Program your widgets as normal and call the object's methods
from within your event handlers. Your objects can exist in the
info structure. Be sure you clean them up properly in your clean-up
routine.

> -I am still not sure about how much functionality one can put into event handlers.

Uh, you put ALL your functionality into event handlers. Just do the
processing as quickly as you can. When you are going to take a long
time at it, follow Liam's advice and put up the hour-glass and
desensitise the widgets. If you prefer NOT to desensitise the widgets,
you could clear all the built-up events in the event queue at the
end of the processing:

Widget_Control, /Clear_Events

> - Finally, I was on a course with David Fanning and he mentioned something about
> distracting the user while you did something to make it look as if you'd done the
> process faster. How would you go about this?

I am quite sure that David Fanning would never recommend
something so devious. Smoke and mirrors is not his usual
modus operandi. The poor fellow must have been at the
end of a gruelling teaching tour to say something like
this. :-)

If he *did* say it, then I'll bet he would implement the
smoke as a beautiful image or perhaps as a modal text
widget that gave the user something to look at for a moment
(knowing Fanning, it would probably be a Rumi poem) while
he was feverishly doing his calculating. The mirrors would
certainly be implemented as pixmaps.

Cheers,

David

----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: several quick questions [message #13200 is a reply to message #13193] Fri, 23 October 1998 00:00 Go to previous message
Liam Gumley is currently offline  Liam Gumley
Messages: 473
Registered: November 1994
Senior Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Keyboard-events
Next Topic: I can't add?

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

Current Time: Wed Oct 08 13:48:40 PDT 2025

Total time taken to generate the page: 0.00718 seconds