[Top][All Lists]

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

RE: Catching Figure close button - callbacks not running?

From: Pantxo
Subject: RE: Catching Figure close button - callbacks not running?
Date: Wed, 30 Jan 2019 02:13:44 -0600 (CST)

Tony Richardson wrote
> Well, I've written several examples that only call drawnow() from within a
> callback.
> (Here's one:  ) So I know that callbacks are
> being run before
> drawnow() is called.
> The documentation you quote seems to be saying (to me) that when drawnow()
> is called
> any queued callbacks will be discarded.   Hmmm, maybe I am flirting with
> disaster by calling
> drawnow from within a callback.  Fortunately, it is the last thing that is
> done.
> Tony

I wrote this part of the doc and that is not how it was supposed to be
interpreted, maybe "flush" was the wrong term. Let me try to explain here
and maybe we can come up with a better doc string.

When graphics callback events are fired from the GUI (main thread), they
cannot be executed right away because the interpreter (worker thread) may be
busy with some other task, so the events are stored in an event queue. Now
here are the possible ways to execute the events:
* The interpreter is idle: every 100ms, Octave processes the eventual events
that have been stored in the queue
* The interpreter is busy executing a program: if the program calls one of
the aforementioned functions (drawnow, pause ...), Octave processes events
in the queue.

So instead of "flush the event queue" one should read "process events in the
queue", or anything that does not mean "discard" :-).


Sent from:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]