www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@ButtonUpManager/getNextEvent.m

    function getNextEvent(obj, cb, statenow)
%GETNEXTEVENT Add a callback to the next button-up event
%
%  GETNEXTEVENT(OBJ, CB) adds a callback that will fire when the next
%  button-up event is captured by the object.  It will then be discarded.
%
%  GETNEXTEVENT(OBJ, CB, STATENOW) optionally specifies what the expected
%  current button state is: false for up, true for pressed.  If the manager
%  thinks the button is up but the specified current state is down,
%  callbacks are immediately fired as this indicates an event ordering
%  problem that should not be allowed to happen.

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


if isempty(obj.OneTimeCallbacks)
    obj.OneTimeCallbacks = {cb};
else
    obj.OneTimeCallbacks(end+1) = {cb};
end

if (nargin>2 && statenow && ~obj.mouseButtonState);
    % Immediately flush events
    obj.pFireCallbacks;
end