www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregMdlGui/@modelpane/modelpane.m

    function obj = modelpane(varargin)
%MODELPANE Constructor for modelpane object
%
%  OBJ = MODELPANE(VARARGIN) creates a new instance of a modelpane.

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


if nargin && isa(varargin{1}, 'xregMdlGui.modelpane')
    obj = varargin{1};
    varargin(1) = [];
else
    obj = xregMdlGui.modelpane;
end

% Call the inherited constructor
abstractlayoutcomponent(obj, varargin{:});

ax = xregGui.scrollaxes('Parent', obj.Parent, ...
    'Visible', obj.Visible, ...
    'Position', obj.Position, ...
    'BackgroundColor', obj.BackgroundColor, ...
    'Xzeromode','left', ...
    'Yzeromode','top');

obj.Display = ax;
obj.hAxes = ax;

% Create model text
obj.doModel;

% Listen to model changing
L = obj.addPropertyListeners( ...
    {'Model', 'BackgroundColor', 'ModelName', 'EmptyDisplayString'}, ...
    {@doModel, {@i_dobgc, ax}, @doModel, @doModel});
set(L, 'CallbackTarget', obj);
obj.hModelPaneList = L;


function i_dobgc(obj, evt, hAx)
set(hAx, 'BackgroundColor', obj.BackgroundColor);