Grid::SetUserDefinedLabelNames

Description

to add user defined labels and name by argument arr.

Syntax

BOOL SetUserDefinedLabelNames( const StringArray & arr, BOOL bCol = TRUE )

Parameters

arr
[input] string array of names of user defined parameters
bCol
[input] true for column labels, false for row labels.

Return

TRUE if success else FALSE.

Examples

EX1

void Grid_SetUserDefinedLabelNames_ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if(wks)
    {
        Grid gg;
        gg.Attach(wks); 
        
        vector<string> vsUDLs = {"Description", "Test OK"};
        gg.SetUserDefinedLabelNames(vsUDLs);
        wks.GetPage().Refresh();
    }
}

EX2

// This example creates a worksheet with 3 columns. Then adds two user defined parameters to the row label. 
void Grid_SetUserDefinedLabelNames_ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if(wks)
    {
        Worksheet wks;
        wks.Create("Origin", CREATE_VISIBLE);
        wks.AddCol();
        Grid gg;
        gg.Attach(wks);  // attach the grid to the worksheet
        vector<string> vsUDLs = {"Operator", "MachineID"};
        gg.SetUserDefinedLabelNames(vsUDLs);   // Add two user defined labels. 
        vector<int> vnTypes;
        gg.GetShowLabels(vnTypes, TRUE);   // Get the current showing column label list 
        vnTypes.Add(RCLT_UDL);
        vnTypes.Add(RCLT_UDL+1);   // update the showing column label list
        gg.SetShowLabels(vnTypes); // Set the showing column labels
        wks.GetPage().Refresh();        
    }
}


CreateUDLRows.png

Empty column label rows are created. To fill with label names, refer to this page.

Remark

See Also

Grid::GetUserDefinedLabelNames Grid::GetShowLabels Grid::SetShowLabels

header to Include

origin.h