2.2.4.22.18 Grid::GetSelection

Description

Retrieves current multiple selection ranges from the Grid.

Syntax

int GetSelection( vector<int> & vR1, vector<int> & vC1, vector<int> & vR2, vector<int> & vC2, BOOL bCheckLabelRows = FALSE )

Parameters

vR1
[output] Receives the vector of indices of the first rows in the selection, if any
vC1
[output] Receives the vector of indices of the first columns in the selection, if any
vR2
[output] Receives the vector of indices of the last rows in the selection, if any
vC2
[output] Receives the vector of indices of the last columns in the selection, if any
bCheckLabelRows
[Input] Check label rows selection if TRUE, default is FALSE.

Return

Number of selected regions in worksheet

Examples

Highlight multiple regions in the worksheet before running the example.

EX1

int    Worksheet_GetSelectedRange_Ex2()
{ 
    WorksheetPage 	wp = Project.WorksheetPages(0);
    if(!wp)
        return -1; 
    Worksheet    	wks(wp.GetName());
    
    Grid 			gg;
    vector<int>		vr1, vc1, vr2, vc2;
    int				iRegions;
    bool			bCheckLabelRows = true;
    if(gg.Attach(wks))
        iRegions = gg.GetSelection(vr1, vc1, vr2, vc2, bCheckLabelRows);
    for(int ii = 0 ; ii < iRegions ; ii++)
    {
        printf("Region %d: R1 = %d, C1 = %d,  R2 = %d, C2 = %d\n", ii+1, vr1[ii], vc1[ii], vr2[ii], vc2[ii]);
    }
    return iRegions;
}

Remark

See Also

Grid::GetSelectedRange, Grid::SetSelection

Header to Include

origin.h