DatasetObject::SetLabel

Description

Set the label (RCLT_LONG_NAME, RCLT_UNIT, RCLT_COMMENT, .. ) from the DatasetObject.

Syntax

BOOL SetLabel(LPCSTR lpcszLabel, int nType, BOOL bX)

Parameters

lpcszLabel
[input] the value
nType
[input] the type, available value: RCLT_LONG_NAME, RCLT_UNIT, RCLT_COMMENT.
bX
[input] TRUE for corresponding sampling interval labels.

Return

TRUE on success and FALSE on failure.

Examples

EX1

void DatasetObject_SetLabel_Ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if( !wks )
        return;

    Column col = wks.Columns(0);
    DatasetObject obj(col);

    if( obj && obj.SetLabel("test ok", RCLT_LONG_NAME, false) )
        out_str("set long name done.");
    else
        out_str("fail to set long name.");
}

EX2

//assume there is a function plot
void DatasetObject_SetLabel_Ex2()
{
    GraphLayer gl = Project.ActiveLayer();
    if( gl )
    {
        DataPlot dp = gl.DataPlots();
        DatasetObject dsObj(dp.GetDatasetName());
        BOOL bSuccess = dsObj.SetLabel("My Function", RCLT_LONG_NAME, FALSE);
        if(bSuccess)
        {
            gl.Invalidate();
            out_str("Set Long Name done.");
        }
    }
}

Remark

See Also

DatasetObject::GetLabel

header to Include

origin.h