www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@containerData/doAttachToFrame.m
function doAttachToFrame(obj, frame) %DOATTACHTOFRAME Attach a listener to frame position property % % obj.doAttachToFrame attempts to attach a listener object to % the position property of the frame figure. % Copyright 2000-2012 The MathWorks, Inc. and Ford Global Technologies, Inc. if mbcgui.util.isComponentParent(frame) obj.framepositionlistener = mbcgui.hgclassesutil.positionlistener(frame, ... mbcutils.callback(@i_forwardpos,obj), 'PostSet'); pos = get(frame, 'Position'); obj.position = [1 1 pos(3:4)]; end function i_forwardpos(~,evt,obj) hFrame = evt.Source; pos = get(hFrame, 'Position'); obj.position = [1 1 pos(3:4)];