bugGNU Octave - Bugs: bug #65459, uifigure ('visible','off')...

 
 

bug #65459: uifigure ('visible','off') temporarily creates a visible figure window

Submitter:  Nicholas Jankowski <nrjank>
Submitted:  Wed 13 Mar 2024 03:29:51 PM UTC
   
 
Category:  Plotting Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * stable Operating System:  * Any
Fixed Release:  10.1.0 (current default) Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 05 May 2024 02:25:34 AM UTC, comment #13: 

With octave-9.1.0 I updated scripts/gui/uifigure.m from octave-10.0.0. This fixed the seg-fault but I found that I needed to initialise "props={}" to avoid a message "error: 'props' undefined ...".

Robert Jenssen <morgawr>
Tue 19 Mar 2024 11:36:36 PM UTC, comment #12: 

I went ahead and coded the more cumbersome process to save unimplemented properties from varargin, call _go_figure_ with regular figure properties, and then set special properties created with addproperty() with the overriden values supplied.  I also updated the documentation to mention the unimplemented properties.
See https://hg.savannah.gnu.org/hgweb/octave/rev/b6f8862f2f5b.

Marking as Fixed and closing report.

Rik <rik5>
Group administrator
Thu 14 Mar 2024 06:00:47 PM UTC, comment #11: 

in that case i would support a blanket uifigure 'not fully implemented' warning on any call to the function that captures some of what Markus said, add a similar 1-line warning message to the docstring (which is the only documentation about uifigure) then let the results fall where thy may.

Nicholas Jankowski <nrjank>
Group Member
Thu 14 Mar 2024 05:17:21 PM UTC, comment #10: 

Yeah. Additionally, one (or more) of the inputs could be a structure. So, checking only the odd ones might miss something.
Octave doesn't actually support uifigures. Afaict, the whole reason for this function to exist is to make functions written for Matlab do something kind of similar.
IMHO, we shouldn't even document it in its current state. No user of Octave should think that the current behavior will resemble what would happen if uifigures will actually get implemented.
Given that, Rik's suggested change is probably good enough. Alternatively, we could just leave it as-is.

Markus Mützel <mmuetzel>
Group administrator
Thu 14 Mar 2024 05:07:16 PM UTC, comment #9: 

Anything is possible.  You could use strcmpi() over the odd-numbered varargin to find occurrences of "Scrollable" or "AutoResizeChildren".  Cut those property names and the following value out of the varargin array and save them.  Then call _go_figure_ with the reduced varargin array and call addproperty().  Finally, call set() with the properties that were cut from the original array.

I wouldn't bother to emit an error here.  At most, you might issue a warning about an unimplemented property.  But, a user could just as easily call uifigure() and then use set() to change a property like "Scrollable" and they will get no error or warning.  So, it will be inconsistent and easy enough for a user to not be informed about the unimplemented property.

This all sounded like a lot of work to me.

Rik <rik5>
Group administrator
Thu 14 Mar 2024 05:06:36 PM UTC, comment #8: 

are those uifigure unique properties documented anywhere?  we don't have a uifigure Graphics Property document, the function just points you to the figure properties page, and a doc search on e.g., AutoResizeChildren doesn't find anything.  

apparently uifigures ignore the close command, too. is that expected, a known issue, or need its own report?

Nicholas Jankowski <nrjank>
Group Member
Thu 14 Mar 2024 03:44:18 PM UTC, comment #7: 


uifigure("scrollable",true)
error: __go_figure__: unable to create figure handle
error: called from
    uifigure at line 54 column 5


how difficult would it be to catch those properties with a better error message?

Nicholas Jankowski <nrjank>
Group Member
Thu 14 Mar 2024 03:26:24 PM UTC, comment #6: 

It would not work with the proposed changes, but I decided that was unimportant since those features are not implemented anyways.

Attempting to use those features would now generate an error, rather than being silently ignored.

Rik <rik5>
Group administrator
Thu 14 Mar 2024 07:34:51 AM UTC, comment #5: 

I assume that a user should be able to set one of the `uifigure`-specific properties ("AutoResizeChildren" or "Scrollable") as input parameters to `uifigure`. Would that still work with the proposed changes?

Markus Mützel <mmuetzel>
Group administrator
Wed 13 Mar 2024 09:21:13 PM UTC, comment #4: 

I don't see this, but I can see how it could happen.  The code in uifigure.m is


  h = __go_figure__ (NaN, "handlevisibility", "off",
                          "numbertitle", "off", "integerhandle", "off",
                          "menubar", "none", "toolbar", "none");

  ## Add uifigure-specific properties on top of regular figure graphics object
  ## FIXME: There is no implementation behind these properties.
  addproperty ("AutoResizeChildren", h, "boolean", "on");
  addproperty ("Scrollable", h, "boolean", "off");

  ## Apply any overrides.
  if (! isempty (varargin))
    set (h, varargin{:});
  endif


The figure is first created, and then more code is executed, and then the additional properties, such as "visible"/"off", are applied.  On a relatively slow machine this could result in the figure being shown and then hidden.

Try the attached replacement uifigure.m which applies the overrides directly in the first call to _go_figure_.

(file #55831)

Rik <rik5>
Group administrator
Wed 13 Mar 2024 05:11:33 PM UTC, comment #3: 

I see it on Win10 octave 8.3
So it is not a regression.

Dmitri.
--



Dmitri A. Sergatskov <dasergatskov>
Wed 13 Mar 2024 04:40:20 PM UTC, comment #2: 

testing with either 9.0.91 or 9.1.0 on Windows 10, I saw it while running "__run_test_suite__", running "test uifigure", or just running "hf = uifigure ("visible", "off")" when using either software driver or system driver


Nicholas Jankowski <nrjank>
Group Member
Wed 13 Mar 2024 04:18:35 PM UTC, comment #1: 

Do you see it if you do "test uifigure" or only during "__run_test_suite__"?
Hardware or software driver?

I do not see it (with software driver) on hgid 773c6bd19630 Win 11.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Wed 13 Mar 2024 03:29:51 PM UTC, original submission:  

Observed on Windows 10 with a recent stable build when running the test suite, it appears that uifigure creates a visible figure window before hiding it when given the ("visible", "off") option.

I was unable to recreate this on Linux with stable or default.

Nicholas Jankowski <nrjank>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #55831:  uifigure.m added by rik5 (3KiB - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by morgawr (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by nrjank (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-03-19 rik5 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 10.1.0 (current default)
    2024-03-14 rik5 Operating SystemMicrosoft Windows Any
    2024-03-13 rik5 Attached File- Added uifigure.m, #55831
        StatusConfirmed Patch Submitted

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code