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 Tech Support » Multiline Grid Cell Collapse All
Subject Author Date
Eddie Judson Jul 26, 2005 - 2:22 AM

A quick question,


     How do I go about displaying multiline CExtGridCellStringDM grid cells? And will the rows automatically stretch to the cell height?


   Regards,


         Eddie

Technical Support Jul 26, 2005 - 6:46 AM

All the string cells in the grid window are designed to be single-line. So, you need to use your own cell class and override the CExtGridCell::OnQueryDrawTextFlags() virtual method, which should invoke the parent method to retrieve the default text flags and remove the DT_SINGLELINE flag from the returned value. You also need to override the CExtGridCell::OnMeasureTextSize() virtual method, which measures the text. That is enough to get multiline text in the cells. The CExtGridCell::OnInplaceControlCreate() virtual method can also be overridden to apply the ES_MULTILINE style to the in-place editor window created by default.

To make the row height variable, you have to define at least one row header and insert the CExtGridCellHeader object into it. This is essential because the grid uses header cells for keeping row widths and column heights. To hide the header column, set its width to zero with the CExtGridWnd::OuterColumnWidthSet() method. The CExtGridCell::ExtentSet() method invoked for the header cell in the header column allows you to set the minimum, maximum and active row height. If all the heights are equal to each other, then the row is not enabled for resizing. Finally, to change the row height when editing is complete, please override the CExtGridCell::OnInplaceControlTextInputComplete() virtual method of the cell class used in data cell area, measure all the cells in the same row, set the row height in the header and invoke the CExtGridWnd::OnSwUpdateScrollBars() method.