bugGNU Octave - Bugs: bug #62748, Inconsistent behavior for gca /...

 
 

bug #62748: Inconsistent behavior for gca / gco / gcf / gcbo / gcbf

Submitter:  None
Submitted:  Mon 11 Jul 2022 04:10:50 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 7.1.0
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 11 Jul 2022 07:13:54 PM UTC, comment #1: 

`gca` and `gcf` need to create objects for compatibility (both with existing code and with Matlab). `gco` could point to a range of different objects. It wouldn't make sense to create a "random" one. (And compatibility again.) `gcbo` and `gcbf` are specific to callbacks (which must have existing parents).

If you'd like get the handle to the current figure without creating a new one if none exists, use this:

get (0, 'CurrentFigure')


If you'd like to get the handle to the current axes of a figure without creating new axes if none exists, use this:

hf = figure ();  % or some other source for a figure handle, e.g.,  `gcf`
get (hf, 'CurrentAxes')


In general, if you have questions about the usage of Octave, the discourse forum might be a better platform than the bug tracker:
https://octave.discourse.group/

Closing as invalid.

Markus Mützel <mmuetzel>
Group administrator
Mon 11 Jul 2022 04:10:50 PM UTC, original submission:  

The statements ` x = gca ` or ` x = gcf ` create new figures if they do not exist but ` x = gco `, ` x = gcbo ` and `x = gcbf ` do not. This is inconsistent. Could this be made consistent to always return [] if the figure does not exist? Other "get" commands like ` x = getframe ` do not create new figures.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  •  

    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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-11 mmuetzel StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code