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

    function h = mv_helpbutton(fig,code,varargin)
%MV_HELPBUTTON Add a help button to a figure
%
%  H = MV_HELPBUTTON(FIG,CODE) adds a Model-Based Calibration Toolbox help
%  button to the figure fig, pointing to help topic CODE.
%
%  H = MV_HELPBUTTON(FIG,CODE,props,vals) passes on the props and vals
%  to the help button on creation.

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


if fig==0
    % dispatcher
    i_helpCB([],[],code);
else
    % create button
    h = i_createbutton(fig,code,varargin{:});
end



function h = i_createbutton(fig,code,varargin)
h = uicontrol('Parent',fig,...
    'Style','pushbutton',...
    'Position',[0 0 65 25],...
    'String','Help',...
    'Callback',{@i_helpCB,code},...
    'Interruptible','off',...
    'Tag','HelpButton',...
    varargin{:});



function i_helpCB(src, evt, helpTag)
hFig = mbcfindfigure(src);
if ~isempty(hFig) && strcmp(get(hFig, 'WindowStyle'), 'modal');
    mv_helptool(helpTag, hFig);
else
    mv_helptool(helpTag);
end