help-octave
[Top][All Lists]
Advanced

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

RE: Catching Figure close button - callbacks not running?


From: Richardson, Anthony
Subject: RE: Catching Figure close button - callbacks not running?
Date: Tue, 29 Jan 2019 21:00:55 +0000


> -----Original Message-----
> From: pavel <address@hidden>
> Sent: Tuesday, January 29, 2019 2:02 PM
> To: Richardson, Anthony <address@hidden>; address@hidden
> Subject: Re: Catching Figure close button - callbacks not running?
> 
> >
> > I *think* the callbacks are run when the event occurs.  That is consistent
> with my experience anyway. It's just that the figure window is not updated
> until drawnow() is run.
> 
> That would be great news since multithreading would be provided.
> Unfortunately until I call drawnow(), the callback does not run in my case (it
> creates some files so easy to check). I have a bit hard time understanding the
> documentation in detail
> 
> 
> ========
> By default callback functions are queued (they are executed one after the
> other in the event queue) unless the drawnow, figure, waitfor, getframe, or
> pause functions are used. If an executing callback invokes one of those
> functions, it causes Octave to flush the event queue, which results in the
> executing callback being interrupted.
> ========
> 
> It does not say whether the queue waits for execution or is executed right
> away in a separate thread. But what I see it seems to run in the main thread -
> my loop waits until drawnow finishes with the callback.
> 
> 
> >
> > It looks as if the onCleanup() function ('help onCleanup') may allow you to
> hook Ctrl+C.  Not sure though, I haven't tried it myself.
> >
> 
> Thanks for the hint. Just Ctrl+C stops the execution right away, no room to
> clear some specific variable to invoke the cleanup. Or maybe I just do not
> undertstand the use properly.
> 
> Thanks a lot!
> 
> Pavel.

Well, I've written several examples that only call drawnow() from within a 
callback.
(Here's one: https://tinyurl.com/ydas6cws  ) 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



reply via email to

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