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 is not working Collapse All
Subject Author Date
Nitin Gahlaut Jul 10, 2010 - 6:57 AM

Hi,


I have used one of  your recommended soution (give by you under subject "CExtReportGridWnd column header alignment")


Please see the below algo.


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:21 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 );