comparison scripts/plot/closereq.m @ 17444:ffa7f1caab4e

Clarify relationship of close, closereq. Recode closereq to put input validation first. * scripts/plot/close.m: Change docstring to place details of implementation at the end. * scripts/plot/closereq.m: Put input validation first.
author Rik <rik@octave.org>
date Thu, 19 Sep 2013 12:01:12 -0700
parents 1c89599167a6
children
comparison
equal deleted inserted replaced
17443:0aa77acf22f5 17444:ffa7f1caab4e
17 ## <http://www.gnu.org/licenses/>. 17 ## <http://www.gnu.org/licenses/>.
18 18
19 ## -*- texinfo -*- 19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {} closereq () 20 ## @deftypefn {Function File} {} closereq ()
21 ## Close the current figure and delete all graphics objects associated with it. 21 ## Close the current figure and delete all graphics objects associated with it.
22 ##
23 ## By default, the @qcode{"closerequestfcn"} property of a new plot figure
24 ## points to this function.
22 ## @seealso{close, delete} 25 ## @seealso{close, delete}
23 ## @end deftypefn 26 ## @end deftypefn
24 27
25 ## Author: jwe 28 ## Author: jwe
26 29
27 function closereq () 30 function closereq ()
28 31
29 if (nargin == 0) 32 if (nargin != 0)
30 cf = gcbf ();
31 if (isempty (cf))
32 warning ("closereq: calling closereq from octave prompt is not supported, use 'close' instead");
33 cf = get (0, "currentfigure");
34 endif
35 if (! isempty (cf) && isfigure (cf))
36 delete (cf);
37 endif
38 else
39 print_usage (); 33 print_usage ();
34 endif
35
36 cf = gcbf ();
37 if (isempty (cf))
38 warning ("closereq: calling closereq from octave prompt is not supported, use 'close' instead");
39 cf = get (0, "currentfigure");
40 endif
41 if (! isempty (cf) && isfigure (cf))
42 delete (cf);
40 endif 43 endif
41 44
42 endfunction 45 endfunction
43 46