function installtip(this,gobjects,tipfcn,info)
%INSTALLTIP  Installs line tip on specified G-objects.

%   Author(s): P. Gahinet
%   Copyright 1986-2004 The MathWorks, Inc.
%   $Revision: 1.1.6.2 $  $Date: 2004/04/11 00:27:37 $

% RE: TIPFCN is either '' or a MATLAB callback. The tip text is generated by evaluating the
%     tip function according to
%        TIPTEXT = feval(@fcn,INFO,arg1,...,argN)
%     for TIPFCN = {@fcn arg1 ... argN}

if isempty(tipfcn)
    for ct = 1:length(gobjects)
        hb = hggetbehavior(gobjects(ct),'DataCursor');
        set(hb,'UpdateFcn',[]);
        %% Create a new datatip on a click
        set(hb,'CreateNewDatatip',true);
    end
else
    for ct = 1:length(gobjects)
        hb = hggetbehavior(gobjects(ct),'DataCursor');
        set(hb,'UpdateFcn',{tipfcn info});
        %% Create a new datatip on a click
        set(hb,'CreateNewDatatip',true);
        % Activate mode when user clicks on response line
        set(gobjects(ct),'ButtonDownFcn',@localLineButtonDown);
    end
end

%%%%%%%%%%  Local Functions   %%%%%%%%%%

function tip = localLineButtonDown(EventSrc,EventData)

tip = linetip(EventSrc);
