www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcwidgets/@Table1D/pCreateCopyPasteAction.m

    function hAction = pCreateCopyPasteAction(obj)
%PCREATECOPYPASTEACTION Create copy and paste actions for the table.
%
%   PCREATECOPYPASTEACTION(OBJ) creates a copy and paste menu action group
%   for the table.

%   Copyright 2007-2011 The MathWorks, Inc.


hAction = mbcmultiview.ActionGroup('', 'CopyPaste', '', '');
hAction.MenuType = 'separate';

cp = mbcmultiview.Action(@(s,e) obj.Peer.copy, '&Copy', 'Copy', '');
pst = mbcmultiview.StatefulAction(@(s,e) obj.Peer.paste, '&Paste', 'Paste', '');
pst.Visible = obj.Editable;
pst.enableStateChange('Visible');

hAction.Actions = [cp pst];

L = handle.listener(obj, obj.findprop('Editable'), ...
    'PropertyPostSet', @(s,e) set(pst, 'Visible', e.NewValue));
p = schema.prop(pst, 'TableEditableListener', 'handle');
p.Visible = 'off';
pst.TableEditableListener = L;
obj.CopyPasteActions = hAction;