2.2.4.22.39 Grid::ShowLabels

Description

show labels

Syntax

BOOL ShowLabels( UINT nType, BOOL bShow = TRUE, BOOL bUndo = FALSE, BOOL bColLabels = true )

Parameters

nType
[input] the type of labels, refer to this list or see RCLT_ emnu in OC_const.h
bShow
[input] true to set show
bUndo
[input] true to support undo mechanism
bColLabels
[input] true for column labels, false for row labels

Return

TRUE if success else FALSE.

Examples

EX1

void Grid_ShowLabels_ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if(wks)
    {
        Grid gg;
        gg.Attach(wks);
        
        bool bShow = gg.IsLabelsShown(RCLT_LONG_NAME);
        gg.ShowLabels(RCLT_LONG_NAME, !bShow);
    }    
}

EX2

// This example creates a worksheet with 3 columns. Then adds two user defined parameters to the row label. 
void Grid_SetUserDefinedLabelNames_ex2()
{
    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. 
        bool bShow = gg.IsLabelsShown(RCLT_UDL);
        gg.ShowLabels(RCLT_UDL, !bShow);
        bShow = gg.IsLabelsShown(RCLT_UDL+1);
        gg.ShowLabels(RCLT_UDL+1, !bShow);
        wks.GetPage().Refresh();        
    }
}

Remark

See Also

Grid::IsLabelsShownGrid::GetShowLabels, Grid::SetShowLabels

Header to Include

origin.h