www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cglookup/propPageGeneral.m
function hInfo = propPageGeneral(obj, hPropGroup) %#ok<INUSL> %PROPPAGEGENERAL Create the General property tab % % INFO = PROPPAGEGENERAL(OBJ, HGROUP) creates the info object that % represents the General tab in a property dialog. % Copyright 2000-2015 The MathWorks, Inc. and Ford Global Technologies, Inc. hInfo = mbcgui.dialog.PageInfo( ... 'PageGroup', hPropGroup, ... 'Name', 'General', ... 'HelpHandler', 'cghelptool', ... 'HelpCode', 'CGTABLEPROPSGENERAL', ... 'CreateCallback', @i_createlyt); function i_createlyt(hInfo, ~) hParent = hInfo.Parent; obj = hInfo.getObject; nmtxt = mbcgui.widget.IconText('Parent', hParent, ... 'ImageFile', iconfile(obj), ... 'String', getname(obj)); divl = xregGui.dividerline('parent', hParent); div2 = xregGui.dividerline('parent', hParent); tpCtrl = i_maketextcontrol(hParent, 'Type:', gettype(obj), 130); inpCtrl = i_maketextcontrol(hParent, 'Number of inputs:', ... sprintf('%d', length(getinputs(obj))), 130); lims = get(obj, 'range'); ud.upperClip = mbcgui.widget.Spinner('Parent', hParent, ... 'Value', lims(2), ... 'Callback', {@i_setclips, hInfo}); ud.lowerClip = mbcgui.widget.Spinner('Parent', hParent, ... 'Value', lims(1), ... 'Callback', {@i_setclips, hInfo}); clipLabel = xregGui.labelcontrol('parent', hParent, ... 'LabelSizeMode', 'absolute', ... 'LabelSize', 130, ... 'ControlSizeMode', 'absolute', ... 'ControlSize', 70, ... 'String', 'Table value limits:', ... 'Control', ud.lowerClip); clipTo = xregGui.labelcontrol('parent', hParent, ... 'LabelSizeMode', 'absolute', ... 'LabelSize', 10, ... 'ControlSizeMode', 'absolute', ... 'ControlSize', 70, ... 'Gap', 10, ... 'String', 'to', ... 'Control', ud.upperClip); hGrid = xreggridbaglayout(hParent, ... 'dimension', [10, 3], ... 'rowsizes', [16 10 2 5 25 25 5 2 10 20], ... 'colsizes', [200 90 -1], ... 'gapx', 10, ... 'mergeblock', {[1 1], [1 3]}, ... 'mergeblock', {[3 3], [1 3]}, ... 'mergeblock', {[5 5], [1 3]}, ... 'mergeblock', {[6 6], [1 3]}, ... 'mergeblock', {[8 8], [1 3]}, ... 'elements', {nmtxt, [], divl, [], tpCtrl, inpCtrl, [], div2, [], clipLabel, ... [], [], [], [], [], [], [], [], [], clipTo}); hInfo.setUI(hGrid); hInfo.UserData = ud; % No other property pages make edits that affect this page, so we don't % need to listen to the object changing function h = i_maketextcontrol(hParent, Label, Text, LabelSize) h = xregGui.labelcontrol('parent', hParent, ... 'LabelSizeMode', 'absolute', ... 'LabelSize', LabelSize, ... 'ControlSizeMode', 'relative', ... 'ControlSize', 1, ... 'String', Label, ... 'Border', [0 5 0 5], ... 'Control', mbcgui.widget.Label('Parent', hParent, ... 'HorizontalAlignment', 'left', ... 'String', Text)); function i_setclips(~, ~, hInfo) ud = hInfo.UserData; obj = hInfo.getObject; lims = sort([ud.lowerClip.Value, ud.upperClip.Value]); if lims(2)<=lims(1); lims(2) = lims(1)+1; end obj = set(obj, 'range', lims); hInfo.updateObject(obj);