Re: Widget event question [message #1043] |
Wed, 19 May 1993 08:50 |
webb
Messages: 3 Registered: May 1993
|
Junior Member |
|
|
offenberg@stars.gsfc.nasa.gov (Joel Offenberg) writes:
> I'm working on a widget application using IDL v3.0, and I would like to know
> if there is any way for me to tell if, at any given time, there is another
> widget event waiting to be processed.
>
> Here's the scoop: In my rouinte, if the user causes certain events, the user
> can change a plot. However, the plot may take a few seconds (or more) to
> recreate, while the human has already clicked to cause another event. What
> I'd like to do is have the routine _only_ redraw the plot when there are no
> pending events, but I don't know how to determine if there are pending widget
> events.
>
> Has anyone done this sort of thing?
> ------------------------------------------------------------ -------------------
One way to tackle this problem is to register your replotting routine as a
background task. Xmanager will wait until there are no events before calling
it. So you don't end up doing too many plots, your plotting routine
needs to check whether any of the parameters have changed before deciding
whether to redraw.
Caveat - I tried to use this method in a similar situation, where the redraw
could take a long time. In my case, my parameters were determined by
sliders. Using /drag_events caused too many redraws, while not using it
meant you had to drop the slider to cause the update to happen (and thus had
to look back and forward from the plot to the slider to find it again). So
I decided to use the background task... BUT sliders seem to be special, and
will not call a background task until you drop the slider anyway! (All this
in IDL 3.0 on a Sun, using Openwindows 3 -- maybe Motif sliders are better
behaved).
Peter Webb
|
|
|