function [str] = getDataCursorText(hThis,hgObject,hDataCursorInfo,varargin)

% This should be a static function, therefore, ignore "hThis"

% Copyright 2002-2004 The MathWorks, Inc.


str = [];
ERRMSG = {'Error in custom','datatip string function'};
        
if nargin>3
  hDatatip = varargin{1};
else
  hDatatip = [];
end

% invoke UpdateFcn defined through behavior object 
if ~isempty(get(hDataCursorInfo,'UpdateFcnCache'))
    try
       str = hgfeval(get(hDataCursorInfo,'UpdateFcnCache'),...
                hDatatip,hDataCursorInfo);
    catch
        str = ERRMSG;
    end
% else invoke class method
elseif get(hDataCursorInfo,'TargetHasGetDatatipTextMethod')
    try
       str = getDatatipText(hgObject,hDataCursorInfo);
    catch
       str = ERRMSG; 
    end
    
% else do default
else
   [str] = hThis.default_getDatatipText(hgObject,hDataCursorInfo);
end


