www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffnode/guiHideExpressions.m
function [obj, changes] = guiHideExpressions(obj) %GUIHIDEEXPRESSIONS Display dialog for hiding expressions % % [OBJ, HASCHANGED] = GUIHIDEEXPRESSIONS(OBJ) displays a modal dialog that % allows the user to select which expressions should be hidden in the % current graphs. % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. hFig = xregdialog('Name', 'Configure Display Items', ... 'MinimumSize', [200 110]); xregcenterfigure(hFig, [400 350]); hInfoText = uicontrol('Parent', hFig, ... 'Style', 'text', ... 'String', 'Uncheck items that you do not want to see plotted in the graphs', ... 'HorizontalAlignment', 'left'); hLabel1 = uicontrol('Parent', hFig, ... 'Style', 'text', ... 'String', 'Input variables:', ... 'HorizontalAlignment', 'left'); hLabel2 = uicontrol('Parent', hFig, ... 'Style', 'text', ... 'String', 'Models:', ... 'HorizontalAlignment', 'left'); hList1 = cgtools.exprList('parent', hFig, ... 'DisplayChecks', true, ... 'DisplayTypeColumn', false, ... 'DisplayHeaderRow', false); hList2 = cgtools.exprList('parent', hFig, ... 'DisplayChecks', true, ... 'DisplayTypeColumn', false, ... 'DisplayHeaderRow', false); % Control buttons hOK = uicontrol('Style', 'pushbutton', ... 'Parent', hFig, ... 'String', 'OK', ... 'Callback', 'set(gcbf, ''tag'', ''ok'', ''visible'', ''off'');'); hCancel = uicontrol('Style', 'pushbutton', ... 'Parent', hFig, ... 'String', 'Cancel', ... 'Callback', 'set(gcbf, ''visible'', ''off'');'); hHelp = cghelpbutton(hFig, 'CGTRADEOFFHIDEEXPRESSION'); hTopGrid = xreggridbaglayout(hFig, ... 'packstatus', 'off', ... 'dimension', [5 3], ... 'rowsizes', [30 10 15 5 -1], ... 'colsizes', [-1 20 -1], ... 'mergeblock', {[1 1], [1 3]}, ... 'elements', {hInfoText, [], hLabel1, [], hList1, ... [], [], [], [], [], ... [], [], hLabel2, [], hList2}); hLayout = xreggridbaglayout(hFig, ... 'dimension', [2 4], ... 'rowsizes', [-1 25], ... 'colsizes', [-1 65 65 65], ... 'gapy', 7, ... 'gapx', 7, ... 'border', [7 7 7 10], ... 'mergeblock', {[1 1], [1 4]}, ... 'elements', {hTopGrid, [], [], hOK, [], hCancel, [], hHelp}); hFig.ContentHandle = hLayout; set(hLayout, 'packstatus', 'on'); % Initialise each list with correct items pIn = pGetOtherInputs(obj); pOut = pGetOutputs(obj); pHidden = getHiddenExpressions(obj); inputChecks = ~ismember(pIn, pHidden); outputChecks = ~ismember(pOut, pHidden); hList1.Items = pIn; hList2.Items = pOut; hList1.setChecks(inputChecks); hList2.setChecks(outputChecks); hFig.showDialog(hOK); % Dialog blocks execution here tg = get(hFig, 'Tag'); changes = false; if strcmp(tg, 'ok') newinputChecks = hList1.getChecks; newoutputChecks = hList2.getChecks; if any(newinputChecks~=inputChecks) || any(newoutputChecks~=outputChecks) obj = setHiddenExpressions(obj, [pIn(~newinputChecks) pOut(~newoutputChecks)]); changes = true; end end delete(hFig);