www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcwidgets/@columnTable/doSetupCTable.m
function doSetupCTable(obj) %DOSETUPCTABLE Setup listeners % % obj.doSetupCTable % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. obj.columnTable_Listeners = [ ... handle.listener(obj, obj.findprop('CurrentRow'), 'PropertyPostSet', {@i_setCurRow, obj.vSliderbar}); ... handle.listener(obj, obj.findprop('ScrollRowLimits'), 'PropertyPostSet', {@i_setScrRowLims, obj.vSliderbar}); ... handle.listener(obj, 'DisplayObjectsChanged', @i_setupGrid); ... handle.listener(obj, 'DataSizeChanged', @i_setupGrid); ... handle.listener(obj, obj.findprop('RowHeight'), 'PropertyPostSet', @i_setPos); ... handle.listener(obj, obj.findprop('TitleHeight'), 'PropertyPostSet', @i_setPos); ... handle.listener(obj, obj.findprop('ScrollbarWidth'), 'PropertyPostSet', {@i_setScrollWidth, obj.gridObject}); ... ]; function i_setCurRow(src, evt, hScroll) set(hScroll, 'Value', -evt.NewValue); function i_setScrRowLims(src, evt, hScroll) obj = evt.AffectedObject; slims = obj.ScrollRowLimits; if all(slims==0) || all(slims==1) set(hScroll, 'Min', -2, 'Max', -1, 'SliderStep', [1 1]); else szData = obj.getVisibleSize; set(hScroll, 'Min', -slims(2), 'Max', -slims(1), 'SliderStep', [1, szData(1)]/(slims(2)-slims(1))); end function i_setupGrid(src, evt) src.doSetupGrid; function i_setScrollWidth(src, evt, hGrid) szcol = get(hGrid, 'colsizes'); if length(szcol)>1 szcol(2) = evt.NewValue; set(hGrid, 'colsizes', szcol); end