2.2.4.46.5 Worksheet::CheckAddLabelByType

Description

Check if a label of the given type already exists among headers. If yes, it will just return its position, If not, it will be added and its position will be returned.

Syntax

int CheckAddLabelByType( UINT nType, int iPos = -1, BOOL bUndo = FALSE, BOOL bColHeaders = true )

Parameters

nType
[input] Label type. It must come from enumerated values RCLT_INVALID etc.
plus an optional offset for RCLT_PARAM, like RCLT_PARAM + 1, RCLT_PARAM + 2, etc.
iPos
[input] The position to add at. Default of -1 means to append.
bUndo
[input] Indicates if the operation needs to support undo. Default is FALSE.
bColHeaders
[input] TRUE for column headers, FALSE for row headers.
Note that for flat sheets this argument must be TRUE.

Return

the index of the position of the added or the existing label, or -1 if error.

Examples

EX1

// The example shows the label "Comment" in the first row of labels (unless
// the "Comment" row is already shown).
void Worksheet_CheckAddLabelByType_Ex1()
{
    Worksheet wks = Project.ActiveLayer();
    
    if ( !wks )
    {
        out_str("No active worksheet");
        return;
    }
    
    UINT nType = RCLT_COMMENT;
    int nRet = wks.CheckAddLabelByType(nType);
    printf("nRet = %d\n", nRet);
    
    return;
}

Remark

See Also

Header to Include

origin.h