2.2.4.27.12 MatrixLayer::Insert

Description

Insert a number of new matrix objects into a matrix layer.

Syntax

int Insert( uint nNumObjs, int nPos = -1, int nType = -1, int nRows = 5, int nCols = 5 )
Note: Currently all matrix objects in the same matrix layer should have the same dimension, so the nRows and nCols are ignored. This is to say, the inserted matrix object would have the same number of rows and columns with the existing matrix objects, no matter what the value you assign to nRows and nCols.

Parameters

nNumObjs
[input] number of new objects to insert
nPos
[input] position to insert first new object, -1(by default) to append
nType
[input] data type. default is -1.
nRows
[input] number of rows in new matrix objects. default is 5.
nCols
[input] number of cols in new matrix objects. default is 5.

Return

An index of the first new matrix objects or a error number less than zero.

Examples

EX1

//Insert a number of new matrix objects into a matrix layer.
void MatrixLayer_Insert_Ex1()
{
    MatrixPage mp = Project.MatrixPages(0);
    if(!mp)
        return;
    
    MatrixLayer ml(mp.GetName());
    if( ml.Insert(1) < 0)
        printf("Fail to insert matrix object!");
    else
        printf("Success to insert matrix object!");
}

Remark

See Also

MatrixLayer::Delete

Header to Include

origin.h