BCGSoft Forums
BCGSoft Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 BCGSuite for MFC
 BCGSuite for MFC
 CBCGPGridCtrl : GroupColumn and SetColumnVisible
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

NicoDeVos

5 Posts

Posted - 06/07/2019 :  07:06:55 AM  Show Profile  Reply with Quote
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,
Nico

Support

4175 Posts

Posted - 06/07/2019 :  08:08:11 AM  Show Profile  Visit Support's Homepage  Reply with Quote
Hi,

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 Technical Support
Go to Top of Page

NicoDeVos

5 Posts

Posted - 06/12/2019 :  03:25:24 AM  Show Profile  Reply with Quote
Hi,

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,
Nico
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To:
BCGSoft Forums © Copyright (c) 1998-2022 BCGSoft Co Ltd Go To Top Of Page
Snitz Forums 2000