www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/+mbcgui/+hgclassesutil/listener.m

    function L = listener(obj, eventname, callback)
%LISTENER Construct an event listener.
%
%   L = LISTENER(OBJ, EVENT, CALLBACK) constructs a listener for the object
%   or vector of objects in OBJ.
%
%   This function will work correctly with both UDD and MCOS objects and
%   will return a listener of a class appropriate for the input object
%   system.  All events will be delivered with a structure that mimics the
%   MCOS system.  Where possible the structure will be a correct MCOS event
%   data object, however this may not always be honoured when the input is
%   a UDD object: in this case the event data will be a Matlab structure.
%
%   Note: this function is a helper for HG conversion work and will be
%   removed in a future release.

%   Copyright 2008-2014 The MathWorks, Inc.

obj = mbcgui.hgclassesutil.toHandle(obj);
L = event.listener(obj, eventname, callback);