Mercurial > hg > octave-lyh
view scripts/plot/set.in @ 6272:a1f3d3b7ee5c
[project @ 2007-02-06 02:09:48 by jwe]
author | jwe |
---|---|
date | Tue, 06 Feb 2007 02:09:48 +0000 |
parents | 44c91c5dfe1d |
children |
line wrap: on
line source
## Copyright (C) 2005 John W. Eaton ## ## This file is part of Octave. ## ## Octave is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2, or (at your option) ## any later version. ## ## Octave is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with Octave; see the file COPYING. If not, write to the Free ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ## 02110-1301, USA. ## -*- texinfo -*- ## @deftypefn {Function File} {} set (@var{h}, @var{p}, @var{v}, @dots{}) ## Set the named property @var{p} to the value @var{v} in the graphics ## handle @var{h}. ## @end deftypefn ## Author: jwe function retval = set (h, varargin) __uiobject_globals__; if (rem (nargin-1, 2) == 0) if (ishandle (h)) idx = __uiobject_handle2idx__ (h); obj = __uiobject_list__(idx).object; if (isfield (obj, "__setter__")) obj = feval (obj.__setter__, h, varargin{:}); else for i = 1:2:nargin-1 property = varargin{i}; if (ischar (property)) key = tolower (property); if (isfield (obj, key)) val = varargin{i+1}; if (isfield (obj, "__validators__")) validators = obj.__validators__; if (isfield (validators, key)) feval (validators.(key), val); endif endif obj.(key) = val; else warning ("set: unrecognized property `%s' for uiobject `%s'", property, obj.type); endif else error ("set: expecting property name to be a character string"); endif endfor endif __uiobject_list__(idx).object = obj; __request_drawnow__ (); if (nargout > 0) retval = h; endif else error ("set: invalid handle"); endif else print_usage (); endif endfunction