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 » GridWnd with background that matches Theme Collapse All
Subject Author Date
Jeremy Ruth Nov 8, 2008 - 7:44 PM

I would like to have my CExtGridWnd derived class basically appear completely transparent.  The text in the cells is this only thing I want to show up.   I want the backcolor of all the cells AND also the non-cell region of the grid (any space below the last row down to the bottom border of the grid) to match the coloring of the current theme.  This particular grid resides on a CFormView.


Is this possible?


If so, I would  also like to make sure any dynamic change of themes would also change the grid appearance accordingly.


Thank you.

Jeremy Ruth Nov 11, 2008 - 9:21 AM

Thank you.  I was able to get the background to look transparent by putting code in the CExtGridBaseWnd::OnGbwEraseArea() virtual method.  However, I do have one issue remaining:  I have one column that is input capable ( a CExtGridCellBool cell that is just a checkbox ).  When I check/uncheck that column, the ’selected’ state of the cell shows as a blue background.  I would like this selected state to also appear as transparent.


I have the following line of code in CExtGridBaseWnd::OnGridCellInputComplete() :


pCellBool->BackColorSet( CExtGridCell::__ECS_ALL, pCellBool->BackColorGet( CExtGridCell::__ECS_NORMAL ) );


This does not have any effect.  Is there a way to have the selected cell’s background also appear transparent?  If so, how and where would I do that?


Thank you again,


Jeremy

Technical Support Nov 10, 2008 - 11:43 AM

The SimpleGrids sample allows all the demo grids in it to use a dialog-like background. Such background is painted in the CDemoGrid::OnSiwPaintBackground() virtual method, where a g_PaintManager->PaintDockerBkgnd() is used. You can also turn off the grid lines by excluding (not-applying) the __EGBS_GRIDLINES style. You can also override the CExtGridBaseWnd::OnGbwEraseArea() virtual method in order to customize the background of header cell areas and data cell area independently from each other. See the source code of the CExtGridBaseWnd::OnGbwEraseArea() virtual method for details: you can uncomment debug/test code at the beginning of this method to see how it works.


Jeremy Ruth Nov 11, 2008 - 9:22 AM

Thank you.  I was able to get the background to look transparent by putting code in the CExtGridBaseWnd::OnGbwEraseArea() virtual method.  However, I do have one issue remaining:  I have one column that is input capable ( a CExtGridCellBool cell that is just a checkbox ).  When I check/uncheck that column, the ’selected’ state of the cell shows as a blue background.  I would like this selected state to also appear as transparent.


 


I have the following line of code in CExtGridBaseWnd::OnGridCellInputComplete() :


 


pCellBool->BackColorSet( CExtGridCell::__ECS_ALL, pCellBool->BackColorGet( CExtGridCell::__ECS_NORMAL ) );


 


This does not have any effect.  Is there a way to have the selected cell’s background also appear transparent?  If so, how and where would I do that?


 


Thank you again,


 


Jeremy

Technical Support Nov 11, 2008 - 9:50 AM

Please implement the CExtGridBaseWnd::SelectionGetForCellPainting() virtual method in your CExtGridWnd-derived class. Your method should return false for thegrid cells which should look like un-selected regardless of their real selected state. It should invoke the parent class method and return a value from it for all the other grid cells.