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 » Variable Row Height for CExtGridCellString with __EGCS_EX_WRAP_TEXT Collapse All
Subject Author Date
the-coder Jun 17, 2010 - 5:05 AM

Hallo,


I`m using a CExtGridCellString cell in my CExtGrid. The CExtGridCellString cell has the __EGCS_EX_WRAP_TEXT set, because I want to store longer texts into the cell.


Now I want the cell to set the row height automatically to the height my CExtGridCellString needs. When it has 10 lines, the row height should be 10 lines, when there is only 1 line, the row height should only show one line.


How can I adjust the row height to the content of my CExtGridCellString cell?

Technical Support Jun 21, 2010 - 12:08 PM

The BestFitRow() API measures all the grid cells in the specified row and computes minimal row size to make the content of each grid cell fully visible. The __EGCS_EX_WRAP_TEXT grid cell style does not affect to the cell size measurement. This means, BestFitRow() API does not have any idea which width would you like to see in the grid cell with wrapped text. As result, the grid column containing cell with wrapped text should have the maximal allowed column width configured from your code programmatically. I.e. you should limit the maximal column widths via invoking the CExtGridCell::ExtentSet() method of the column header cell.

Technical Support Jun 21, 2010 - 12:08 PM

The BestFitRow() API measures all the grid cells in the specified row and computes minimal row size to make the content of each grid cell fully visible. The __EGCS_EX_WRAP_TEXT grid cell style does not affect to the cell size measurement. This means, BestFitRow() API does not have any idea which width would you like to see in the grid cell with wrapped text. As result, the grid column containing cell with wrapped text should have the maximal allowed column width configured from your code programmatically. I.e. you should limit the maximal column widths via invoking the CExtGridCell::ExtentSet() method of the column header cell.

Technical Support Jun 19, 2010 - 11:45 AM

The __EGCS_EX_WRAP_TEXT extended grid cell style makes the text grid cell automatically organize the text into a larger number for text lines when there is not enough width available. But if your text cells containing multiline text based on the carriage return character, then you should also specify the __EGCS_EX_MULTILINE_TEXT extended grid cell style which enables support of the carriage return character and also makes cell in-place editor multiline.
The CExtGridWnd::BestFitRow() method can be invoked after initializing all the cells in the grid row. This method will automatically adjust row height. Please note, your grid control should be configured to support variable row heights. I.e. the __EGBS_FIXED_SIZE_ROWS style should not be specified. The row heights are stored in the outer header cells at left or right. So, you should add at least one header column at left and initialize it with CExtGridCellHeader grid cells. If you don’t want to see this outer header column, then you should set its width to zero using the CExtGridBaseWnd::OuterColumnWidthSet() method.

the-coder Jun 21, 2010 - 11:08 AM

Ok, it works for texts with line breaks. Is it possible to use the BestFitRow Funcstion for wrapped text which is too long for one column also? Here is a screenshot: I manually resized the second inner row a little bit to show what is meant


Wrapt