www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcmultiview/@MultiViewPanel/splitView.m

    function splitView(obj, Orient, ViewIndex)
%SPLITVIEW Split the currently selected view
%
%  SPLITVIEW(OBJ, ORIENT, VIEWINDEX) splits the currently selected view.
%  ORIENT specifies which direction to split the view in.  If this is left
%  empty the view will be split in its preferred direction.  VIEWINDEX
%  specifies the new view that should be created.  If this is left empty,
%  the next view will be chosen automatically.

%  Copyright 2005 The MathWorks, Inc. and Ford Global Technologies, Inc.


hVC = obj.ViewGroup.SelectedViewContainer;
if ~isempty(hVC)
    if nargin<3 || obj.ViewList.isViewAvailable(obj.MessageService, ViewIndex);
        P = xregGui.PointerRepository;
        PtrID = P.stackSetPointer(obj.Parent, 'watch');
        MsgID = obj.pAddStatusMessage('Splitting current view...');

        if nargin<3 || isempty(ViewIndex)
            hNewVC = obj.pCreateView;
        else
            hNewVC = obj.pCreateView(ViewIndex);
        end 
        obj.ViewGroup.selectView(hNewVC);
        
        if nargin<2 || isempty(Orient)
            Orient = hVC.View.defaultSplitDirection;
        end
        obj.pSplitView(hVC, Orient, hNewVC);
        hNewVC.Visible = obj.Visible;

        obj.pRemoveStatusMessage(MsgID);
        P.stackRemovePointer(obj.Parent, PtrID);
    else
        h = errordlg(['This view is currently not available.  ', ...
            'Please select a different view.'], ...
            'MBC Toolbox', 'modal');
    end
end