www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffgui/@tableTableView/pSwitchLegendMode.m
function pSwitchLegendMode(obj) %PSWITCHLEGENDMODE Perform actions to turn legend on/off % % PSWITCHLEGENDMODE(OBJ) will create or destroy objects as needed in order % to make the table's display match the setting for displaying the legend. % Copyright 2000-2013 The MathWorks, Inc. and Ford Global Technologies, Inc. if obj.ShowLegend if isempty(obj.hLegendPanel) || ~isgraphics(obj.hLegendPanel) % Create objects obj.pCreateLegendObjects; % Set correct state for model icon obj.pSetLegendModelIcon(obj.ShowLegendValidModel); end % Install legend panel into the grid set(obj.Display, 'rowsizes', [-1 52],'gapy',2,'elements', {obj.hTable, obj.hLegendPanel}); else % Remove legend panel from the grid set(obj.Display, 'rowsizes', [-1 0], 'elements', {obj.hTable, []}); if ~isempty(obj.hLegendPanel) && isgraphics(obj.hLegendPanel) % Destroy objects delete(obj.hLegendPanel); end end