function updategrid(this,varargin)
%UPDATEGRID  Redraws custom grid.

%   Author: P. Gahinet
%   Copyright 1986-2004 The MathWorks, Inc.
%   $Revision: 1.1.6.3 $ $Date: 2004/11/18 23:41:56 $
% RE: Callback for LimitChanged event
if ~isempty(this.GridFcn) & strcmp(this.Grid,'on')
    
    % Clear existing grid
    cleargrid(this)

    fig = ancestor(this.Parent,'hg.figure');
    
    % Save current zoom mode
    zoommode = zoom(fig,'getmode');
    
    % Evaluate GridFcn to redraw custom grid
    GridHandles = feval(this.GridFcn{:});
    this.GridLines = handle(GridHandles(:));
    
    % Restore zoommode if necessary
    if strcmpi('in',zoommode),
        zoom(fig,'on');
    elseif strcmpi('out',zoommode),
        zoom(fig,'outmode');
    end
    
end

% if ~isempty(this.GridFcn) & strcmp(this.Grid,'on')
%     
%     % Clear existing grid
%     cleargrid(this)
% 
%     % Save current zoom mode
%     zoommode = zoom(double(this.Parent),'getmode');
%     
%     % Evaluate GridFcn to redraw custom grid
%     GridHandles = feval(this.GridFcn{:});
%     this.GridLines = handle(GridHandles(:));
%     
%     % Restore zoommode if necessary
%     if strcmpi('in',zoommode),
%         zoom(double(this.Parent),'on');
%     elseif strcmpi('out',zoommode),
%         zoom(double(this.Parent),'outmode');
%     end
%     
% end