2.2.6.17.21 GridControl::GetCols


Description

Gets the number of columns

Syntax

int GetCols( )

Parameters

Return

the number of columns

Examples

Example codes can be pasted to doExample() function in GridControl's examples to run

        vector<string> vsItems = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
	vector<string> vsItems2 = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"};
	vector<byte> vByte={1,0,0};
	vector<int> vInt(3);
	vector<bool> vShow={1,0,1};
	m_GridCtrl.CheckExpandRows( vsItems.GetSize()- 1 );
	m_GridCtrl.SetCols(3,true);
	m_GridCtrl.SetCells(vsItems, 0);
	m_GridCtrl.SetCells(vsItems2, 1);
	m_GridCtrl.SetCells(vsItems, 2);
		
	out_int("cols num=",m_GridCtrl.GetCols());
	MessageBox(GetSafeHwnd(), "continue");

	m_GridCtrl.SetIsColHidden(1,true);
	m_GridCtrl.SetIsRowHidden(3,true);
	MessageBox(GetSafeHwnd(), "continue");		

	m_GridCtrl.SetHiddenCols(vByte,true);//override the former hiden setting
	m_GridCtrl.ShowCols(vShow);//override the former hiden setting again
		
	out_int("column 1's hidden status is ",m_GridCtrl.GetIsColHidden(1));//be overrided
	out_int("column 1's hidden status is ",m_GridCtrl.IsColHidden(1));//similar function
		
	out_int("Row 3's hidden status is ",m_GridCtrl.GetIsRowHidden(3));//remain hidden
		
	m_GridCtrl.GetColsShow(vInt,FALSE);
	out_str("showed columns");
	for(int ii=0;ii<vInt.GetSize();ii++)
		printf("%d\t",vInt[ii]);//printf the index of showed columns
	printf("\nhidden status\n");
		
	m_GridCtrl.GetHiddenCols(vByte);
	for(int jj=0;jj<vByte.GetSize();jj++)
		printf("%d\t",vByte[jj]);//printf the hidden status of columns, 1 implies hiden

Remark

See Also

GridControl::SetCols
GridControl::GetNumCols

Header to Included

GridControl.h