# HG changeset patch # User John W. Eaton # Date 1216761808 14400 # Node ID 5747be3ac49701b528693d40996e8c39db0dbf73 # Parent 6a6a030a3517d0f168fe5b1bfec8729a2af23f3a Implement closereq as real callback execution diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,9 @@ +2008-07-21 Michael Goffioul + + * plot/closereq.m: Use first gcbf to get the handle of the figure to + be closed. + * plot/close.m: Call __go_execute_callback__. + 2008-07-17 John W. Eaton * general/fliplr.m: Fix usage test. diff --git a/scripts/plot/close.m b/scripts/plot/close.m --- a/scripts/plot/close.m +++ b/scripts/plot/close.m @@ -59,8 +59,7 @@ endif for h = figs - set (0, "currentfigure", h); - feval (get (h, "closerequestfcn")); + __go_execute_callback__ (h, "closerequestfcn"); endfor if (nargout > 0) diff --git a/scripts/plot/closereq.m b/scripts/plot/closereq.m --- a/scripts/plot/closereq.m +++ b/scripts/plot/closereq.m @@ -28,8 +28,12 @@ function closereq () if (nargin == 0) - cf = get (0, "currentfigure"); - if (cf != 0) + cf = gcbf (); + if (isempty (cf)) + warning ("closereq: calling closereq from octave prompt is not supported, use `close' instead"); + cf = get (0, "currentfigure"); + endif + if (! isempty (cf) && cf != 0) delete (cf); endif else