www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@cgbrowser/lock.m

    function OK = lock(h)
%LOCK Lock the CAGE browser
%
%  LOCK(CGB) returns true if the CAGE browser was successfully locked  and
%  false otherwise.  Locking will fail if the browser is already locked, so
%  this function should be used to determine if the  cgbrowser is available
%  for further operations, for example using the code:
%
%    c = cgbrowser;
%    if c.lock
%        % Execute actions...
%
%        c.unlock;
%    end

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


if h.GUIExists
    if ~h.GUILocked
        h.GUILocked = true;
        set([h.Hand.Types.Lists{2,:}],'Enable','off');
        OK = true;
    else
        OK = false;
    end
else
    OK = false;
end