BCGSoft Forums
BCGSoft Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 BCGSuite for MFC
 BCGSuite for MFC
 CBCGPGridCtrl : GroupColumn and SetColumnVisible

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Insert Smilie

* Forum Code is ON


T O P I C    R E V I E W
NicoDeVos Posted - 06/07/2019 : 07:06:55 AM
Dear all,

In the ("BCGSuite for MFC") example "Examples\BCGPGridExample\ReportGridCtrl" we have the code snippet to "hide" a column

int CReportGridCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
	SetColumnVisible (4, FALSE);
	SetColumnVisible (5, FALSE);

I would like to use it in a derived *CBCGPGridCtrl* control where i also use the InsertGroupColumn call, like in the example ColorGridCtrl. The motivation is that i have already the text of the column in the group text. But i fail to hide the column.
Also in the example isn't working:

int CColorGridCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) 
	InsertColumn (nColumn, strColumn, 80);

   SetColumnVisible (1, FALSE);
   // Group by first column:
   InsertGroupColumn (0, 0);

Did someone experienced a same issue?
Is it technical possible to hide a column (for example the grouping column) and use at the same time the grouping?

Thanks in advance, best regards,
2   L A T E S T    R E P L I E S    (Newest First)
NicoDeVos Posted - 06/12/2019 : 03:25:24 AM

Thanks for your answer. Based on your answer I could make it working.

As I use the grid in a dialog (and not in a view), i moved the SetColumnVisible call to the end of the dialog ::OnInitDialog() method (after m_wndGrid->LoadState...) and now it works.

Thanks again, best regards,
Support Posted - 06/07/2019 : 08:08:11 AM

OnCreate is not a good place to hide/show the columns, because the grid state will be loaded from registry later.

Please consider to hide columns in your CMainFrame::LoadFrame (after call to parent method).

Best regards,

BCGSoft Forums © Copyright (c) 1998-2022 BCGSoft Co Ltd Go To Top Of Page
Snitz Forums 2000