www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffgui/@listCentricUI/pGetCommands.m

    function cmdStruct = pGetCommands(obj, varargin)
%PGETCOMMANDS Create structure containing callback function handles
%
%  CMDSTRUCT = PGETCOMMANDS(OBJ) returns a structure containing all of the
%  callback function handles.  All of these callbacks take the object as
%  their only argument.
%
%  PGETCOMMANDS(OBJ, 'Command1', Func1, ...) allows the addition of extra
%  commands and associated function handles.

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


cmdStruct = obj.super('pGetCommands', ...
    'MinimizeInput', @i_mininput, ...
    'MaximizeInput', @i_maxinput, ...
    'TurningOfInput', @i_turninput, ...
    varargin{:});



% Set of functions that handle finding the min, max or turning point of a
% model
function i_maxinput(varargin)
obj = i_getobject(varargin{:});
i_alterinput(obj, 'max');

function i_mininput(varargin)
obj = i_getobject(varargin{:});
i_alterinput(obj, 'min');

function i_turninput(varargin)
obj = i_getobject(varargin{:});
i_alterinput(obj, 'turn');

function i_alterinput(obj, changetype)
ms = obj.MessageService;
pOut = obj.GraphsView.SelectedOutput;
pIn = obj.GraphsView.SelectedInput;
if ~isnull(pIn) && ~isnull(pOut)
    obj.pStartLongAction;
    switch changetype
        case 'min'
            ms.TradeoffServices.setValueAtMinOf(pIn, pOut);
        case 'max'
            ms.TradeoffServices.setValueAtMaxOf(pIn, pOut);
        case 'turn'
            ms.TradeoffServices.setValueAtTurnOf(pIn, pOut);
    end
    obj.pEndLongAction;
end


% Helper function that decodes the possible inputs and returns an object.
% reference
function obj = i_getobject(src, evt, obj)
if nargin==1
    obj = src;
elseif nargin~=3
    error('mbc:cgtradeoffgui:tradeoffBrowserDisplay:InvalidArgument', ...
        'Invalid calling syntax for callback function.');
end