bugGNU Octave - Bugs: bug #56470, Open figures do not raise closing...

 
 

bug #56470: Open figures do not raise closing event when [X] is pressed

Submitted by:  Deyan <dvd_video>
Submitted on:  Tue 11 Jun 2019 07:27:17 AM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Invalid Assigned to:  None
Originator Name:  Deyan Open/Closed:  Closed
Release:  5.1.0 Operating System:  Microsoft Windows

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Thu 13 Jun 2019 08:10:54 AM UTC, comment #8: 

Sure, "drawnow" is available in Matlab, you can change your code to drawnow and it will work in both Octave and Matlab.

Closing report as invalid.

Pantxo Diribarne <pantxo>
Project Member
Thu 13 Jun 2019 07:16:28 AM UTC, comment #7: 

If Drawnow is available in Matlab 7.5, then yes ;), else I'll need another solution ...

Deyan <dvd_video>
Wed 12 Jun 2019 07:48:33 PM UTC, comment #6: 

Thanks. Can I close this report as invalid?
Drawnow is the only documented way (even in Matlab) to have graphics events processed and figures refreshed.

Pantxo Diribarne <pantxo>
Project Member
Wed 12 Jun 2019 10:55:59 AM UTC, comment #5: 

The only place I need to update this is drawCurvDFT and drawSurfDFT

drawnow:
When the loop is not broken I added drawnow after the last grid draw for the system to update the event if the figure is closed. When the X is pressed the figure closes correctly as like pause(0.1). Probably the performance issue that drawnow draws a frame in a second is of the fact that I am running my program on a laptop rather than a desktop.

pause:
This mode is working identically as drawnow, but I am gonna use drawnow as a standard solution to avoid slowing loops in the figure update routine.

I think that for the refresh in one second there is nothing more to be done now. My home desktop machine is more powerful than my laptop, so I think it's normal.

Deyan <dvd_video>
Wed 12 Jun 2019 09:36:44 AM UTC, comment #4: 

Did you try "drawnow"? If so does it delay the drawing 1 second? Does it fix the problem of the figure not being closed while the [x] button has been pressed?

As for the second question, it has nothing to do with this report. Please keep issues distinct.

Pantxo Diribarne <pantxo>
Project Member
Wed 12 Jun 2019 08:54:38 AM UTC, comment #3: 

Hello,

Both bugfixes work the same. They both delay the draw exactly one second, which is strange for the pause function regarding the argument of 0.1 seconds.

1. Why does it delay for one second even though the argument is 0.1 ?
2. Why is the current directory changed to "C:\Users\<USER>" when the program starts ?

Deyan <dvd_video>
Tue 11 Jun 2019 07:07:54 PM UTC, comment #2: 

In comment #1, "...the figure get redrawn until..." should read "...the figure won't get redrawn until...".

Pantxo Diribarne <pantxo>
Project Member
Tue 11 Jun 2019 02:56:32 PM UTC, comment #1: 

The reason why the figure is only refreshed when interacting with the windows somehow, is because Qt deems the redraw necessary and provokes it.

Otherwise, the figure get redrawn until either you call "drawnow" or "pause" explicitely in your loop, or the script terminates and Octave returns to prompt. Same for closing a window: unless you call drawnow, the close event won't be processed.

Could you try adding a "drawnow" or "pause (0.1)" somewhere in your loop and report back?

Pantxo Diribarne <pantxo>
Project Member
Tue 11 Jun 2019 07:27:17 AM UTC, original submission:  

Hello,

Consider my Matlab University project for data processing control which is an MP3 player with different plotters, FFT, `audioplayer` manipulation and playlist located here:

https://github.com/dvdvideo1234/MP3Toolbox

In the code, I am using the following:

```matlab

function fig = getNextFigure()
  % Returns the top free figure handle to be opened
  if(isempty(get(0,'CurrentFigure')))
    fig = 1;
  else
    fig = max(get(0,'Children')) + 1;
  end
end

fig = getNextFigure(); % Maximum figure ID and increment it

 

while( <some_condition_here> )
  figure(fig)
  if(~ishandle(fig))
    break;
  else
    <what_the_loop_does>;
  end
end
```

In Octave, the opened figure hangs and it does not draw in real-time. The figure only draws the first plot and then the window needs to be moved for it to draw the next plot. The figure window cannot be closed. When closed, the figure must trigger `~ishandle(fig)` and disappear afterward while braking the loop. Instead, it cannot be closed and rather floods itself up. It can only be stopped by flooding the command window with left clicks to change OS active window and flood `^C`. The figure is refreshed every time an OS active window is selected in the taskbar ( Tried with windows explorer. Click-flooding the windows explorer in the taskbar gives slow and promising result, however, the figure is destroyed after a couple of times. )

In Matlab, the figure opens normally and the subplots are updated accordingly. The graph runs smoothly and it does not hang at all. The figure can be closed, the loop is broken and the figure returns the control to the command window of the MP3 player.

Deyan <dvd_video>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #47067:  octave-1.JPG added by dvd_video (173KiB - image/jpeg - Thy to hit the [X] to close the figure.)
file #47068:  octave-2.JPG added by dvd_video (197KiB - image/jpeg - Thy to hit the [X] to close the figure.)
file #47069:  octave-3.jpg added by dvd_video (257KiB - image/jpeg - Thy to hit the [X] to close the figure.)
file #47070:  octave-4.JPG added by dvd_video (123KiB - image/jpeg - Thy to hit the [X] to close the figure.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by dvd_video (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-13 pantxo StatusNeed Info => Invalid
        Open/ClosedOpen => Closed
    2019-06-11 pantxo StatusNone => Need Info
    2019-06-11 dvd_video Attached File- => Added octave-1.JPG, #47067
        Attached File- => Added octave-2.JPG, #47068
        Attached File- => Added octave-3.jpg, #47069
        Attached File- => Added octave-4.JPG, #47070

    Back to the top


    Powered by Savane 3.5