diff scripts/plot/uimenu.m @ 11295:75ff3db6a687

Simplify code for uimenu.m. Fix error messages for ui file functions.
author Kai Habel <kai.habel@gmx.de>
date Thu, 25 Nov 2010 17:16:46 +0100
parents a06759adaa79
children 1740012184f9
line wrap: on
line diff
--- a/scripts/plot/uimenu.m
+++ b/scripts/plot/uimenu.m
@@ -79,24 +79,18 @@
 function hui = uimenu (varargin)
 
   args = varargin;
-  if (nargin == 0)
+
+  if (ishandle (args{1}))
+    h = args{1};
+    args(1) = [];
+  else
     h = gcf ();
-  elseif (nargin == 1)
-    if (ishandle (args{1}))
-      h = args{1};
-      args(1) = [];
-    else
-      error ("expected handle as first argument");
-    endif
-  else
-    if (ishandle (args{1}))
-      h = args{1};
-      args(1) = [];
-    else
-      h = gcf ();
-    endif
   endif
-  
+
+  if (rem (length (args), 2))
+    error ("uimenu: expecting property/value pairs");
+  endif
+
   tmp = __go_uimenu__ (h, args{:});
 
   if (nargout > 0)