changeset 33028:cd61d41dc913

hdl2struct.m: Fix saving of buttondownfcn and other callbacks (bug #65315) * hdl2struct.m (getprops): Filter out only read-only properties and parent/children properties, and save all the rest.
author Rik <rik@octave.org>
date Thu, 15 Feb 2024 16:38:45 -0800
parents 489026b7257b
children 459ad9067f62
files scripts/plot/util/hdl2struct.m
diffstat 1 files changed, 7 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/util/hdl2struct.m	Thu Feb 15 15:40:42 2024 -0500
+++ b/scripts/plot/util/hdl2struct.m	Thu Feb 15 16:38:45 2024 -0800
@@ -51,7 +51,7 @@
     s.special = [];
 
     ## Process, in reverse order, all children except for
-    ## legends, colorbars, uimenu, and hggroup children
+    ## legends, colorbars, uimenu, and hggroup children.
     ii = 0;
     allkids = get (h, "children");
     if (! strcmp (s.type, "hggroup"))
@@ -71,7 +71,7 @@
     endif
 
     ## Add non "children" children objects (title, xlabel, ...) and
-    ## hggroup children and tag them in "special"
+    ## hggroup children and tag them in "special".
     if (strcmp (s.type, "hggroup"))
       special = allkids;
     else
@@ -88,8 +88,8 @@
 
     if (strcmp (s.type, "axes") ...
         && ! any (strcmp (get (h, "tag"), {'colorbar', 'legend'})))
-      ## look for legends and colorbars among axes brothers and add them
-      ## to the children list
+      ## Look for legends and colorbars among axes brothers and add them
+      ## to the children list.
       try
         lg = get (h, "__legend_handle__");
       catch
@@ -146,13 +146,8 @@
   persistent excluded;
 
   if (isempty (excluded))
-    excluded = cell2struct (repmat ({[]}, 1, 17),
-                            {"beingdeleted", "busyaction", "buttondownfcn", ...
-                             "children", "clipping", "contextmenu", ...
-                             "createfcn", "deletefcn", "handlevisibility", ...
-                             "hittest", "interruptible", "parent", ...
-                             "selected" , "selectionhighlight", ...
-                             "selectedobject", "type", "uicontextmenu"}, 2);
+    excluded = cell2struct (repmat ({[]}, 1, 4),
+                            {"beingdeleted", "children", "parent", "type"}, 2);
   endif
 
   obj = get (h);
@@ -174,6 +169,7 @@
 
 endfunction
 
+
 ## FIXME: need validation tests
 
 ## FIXME: Need to test code for legends, colorbars.