Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » CExtReportGridWnd column header alignment Collapse All
Subject Author Date
ganesan m May 19, 2010 - 10:48 PM

Hi,


I wanna create a grid using CExtReportGridWnd with fixed column header alignment i.e. whenever user changes column alignment (left or right or center or by type) data in grid cells only should be aligned and alignment of column header should not change.


Could someone help me in implementing this?


 


Thanks,


Ganesh

Nitin Gahlaut Jul 10, 2010 - 6:49 AM

Hi,


I  have implemented the solution which is recommended by you as follows:

Override CExtReportGridWnd::ReportColumnAdjustTextAlignmentH() function.


ReportColumnAdjustTextAlignmentH()

{

              //Get the style of the Cell or Columns (as per requirement)

              align = GetStyle();


             CExtReportGridWnd::ReportColumnAdjustTextAlignmentH(pRGC, align, RedrawFlag);


             //Then update the Header alignment

             CExtGridCell *Cell = GridCellGetOuterAtTop(ColNum, RowNum, RUNTIME_CLASS( CExtGridCellHeader ));

             Cell->ModifyStyle(__EGCS_TA_***);

}


This algorithms is working fine and changing the header alignment as per ModifyStyle() and cell alignment as per alignment variable (“align” in above code). But I observed some issues


Issue 1: When right click on header->Alignment, it always shows selected alignment type is “Center” doesn’t matter whether cells are left/right aligned. I want alignment option as per cells’ aliment bases instead of columns. So any solution for this?

 

Issue 2: Changed alignment (say left or right) and reopen the application. Gird resets the last saved alignment style to default.

I observed that GetStyle (in above algo) is returning a junk value. I also tried to used GetStyleEx() function but it is always retuning 0.


So can you please tell me how can I get the correct style value or how I can I restore last saved alignment style.


Thanks in advance.

Technical Support Jul 12, 2010 - 2:24 AM

You should use the CExtGridCell::ModifyStyle() API for changing text alignment. The text alignment is specified using the following style flags:

#define __EGCS_TA_HORZ_BY_TYPE                                                                  0x00000000L
#define __EGCS_TA_HORZ_LEFT                                                                                 0x00000001L
#define __EGCS_TA_HORZ_RIGHT                                                                    0x00000002L
#define __EGCS_TA_HORZ_CENTER                                                                0x00000003L
#define __EGCS_TA_HORZ_MASK                                                                                0x00000003L
This means you should remove the previous alignment flags by removing the __EGCS_TA_HORZ_MASK masked flags. In other words, you should invoke the CExtGridCell::ModifyStyle() API with two paramenters:
CExtGridCell * pCell = . . .
pCell->ModifyStyle( __EGCS_TA_HORZ_RIGHT, __EGCS_TA_HORZ_MASK );

Technical Support May 20, 2010 - 1:37 PM

Please override the CExtReportGridWnd::ReportColumnAdjustTextAlignmentH() virtual method in your CExtReportGridWnd-derived class. Your method should invoke the parent class method first and then reset the alignment styles of the CExtReportGridColumn * pRGC object (the __EGCS_TA_*** styles).