www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregtextinput/set.m

    function obj = set(obj, varargin)
% xregtextinput/SET
%     set(xregtextinput, 'Property', Value)
%     Property = {'numCells', 'Position', 'varName', 'Parent'}
%
%     Also at this time only one parameter value pair per call
%     can be used
%
%     This form of the set method return a modified form
%     of the object
%

%  Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc.



d = length(varargin)/2;
nparam = floor(d);

for arg=1:2:nparam*2-1
   parameter = varargin{arg};
   value = varargin{arg+1};
   switch upper(parameter)
      
   case 'POSITION'
      pos=value;
      if pos(3) < 20
         pos(3) = 20;
      end
      if pos(4) < 20
         pos(4) = 20;
      end
      set(obj.hnd,'Position',pos);
      
   case 'VARNAME'
      if ischar(value)
         set(obj.hnd,'String',value);
      end
      
   case 'VISIBLE'
      if ischar(value)
         switch upper(value)
         case 'OFF'
            set(obj.hnd,'Visible','off');
         case 'ON'
            set(obj.hnd,'Visible','on');
         end
      end
      
   case 'PARENT'
      if isgraphics(value)
         set(obj.hnd,'Parent',value);
      end
      
   case 'CALLBACK'
      %% no callback for xregtextinput
      
   case 'VALUE'
      %% no value for xregtextinput
      
   case 'FONTWEIGHT'
      try
         set(obj.hnd,'FontWeight',value);      
      end
      
   otherwise
      try
         set(obj.hnd, parameter, value);
      catch
         warning(message('mbc:xregtextinput:InvalidPropertyName'));
      end
      
   end %switch
end