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

    function doSetup(h)
%DOSETUP  Create listeners
%

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


h.PropL=[handle.listener(h,h.findprop('Xviewpos'),'PropertyPostSet',@i_updateX);...
      handle.listener(h,h.findprop('Xlim'),'PropertyPostSet',@i_updateX);...
      handle.listener(h,h.findprop('Xdataperpixel'),'PropertyPostSet',@i_updateX);...
      handle.listener(h,h.findprop('Yviewpos'),'PropertyPostSet',@i_updateY);...
      handle.listener(h,h.findprop('Ylim'),'PropertyPostSet',@i_updateY);...
      handle.listener(h,h.findprop('Ydataperpixel'),'PropertyPostSet',@i_updateY);...
      handle.listener(h,h.findprop('BackgroundColor'),'PropertyPostSet',{@i_docolor, h.AxesHandle});...
      handle.listener(h,h.findprop('UIContextMenu'),'PropertyPostSet',{@i_douic, h.AxesHandle});...
      handle.listener(h,h.findprop('Xzeromode'),'PropertyPostSet',@i_updateX);...
      handle.listener(h,h.findprop('Yzeromode'),'PropertyPostSet',@i_updateY);...
      handle.listener(h,h.findprop('ZoomMode'),'PropertyPostSet',@i_updateZoom);...
      handle.listener(h,h.findprop('BorderType'),'PropertyPostSet',{@i_updateBorderType, h.PanelHandle});...
      handle.listener(h,h.findprop('InnerBorder'),'PropertyPostSet',@i_updateInnerBorder);...  
];


function i_updateX(srcobj,evt)
obj=evt.AffectedObject;
obj.doXlim;
obj.doXdraw;

function i_updateY(srcobj,evt)
obj=evt.AffectedObject;
obj.doYlim;
obj.doYdraw;

function i_updateZoom(srcobj, evt)
obj = evt.AffectedObject;
obj.doZoom;

function i_docolor(srcobj,evt, hAx)
h=evt.AffectedObject;
if ~(ischar(h.BackgroundColor) && strcmp(h.BackgroundColor,'none'))
    set(hAx, ...
        'Color', h.BackgroundColor, ...
        'XColor', h.BackgroundColor, ...
        'YColor', h.BackgroundColor, ...
        'ZColor', h.BackgroundColor);
end

function i_douic(srcobj,evt, hAx)
h=evt.AffectedObject;
if isempty(h.UIContextMenu)
    set(hAx, 'UIContextMenu', [], 'HitTest', 'off');
else
    set(hAx, 'UIContextMenu', h.UIContextMenu, 'HitTest', 'on');
end

function i_updateBorderType(srcobj, evt, hPanel)
set(hPanel, 'BorderType', evt.NewValue);

function i_updateInnerBorder(srcobj, evt)
h.pPostSetPosition;