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 » grid row height Collapse All
Subject Author Date
Osmin Lazo Jun 23, 2005 - 8:54 AM


Good day Technical Support,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>


Is there a way to set the height of rows while the grid is being drawn (changing the height based on the contents of the row)?


 <o:p></o:p>


Thanks in advanced.


 

Technical Support Jun 24, 2005 - 3:24 AM

The grid control knows nothing about data types displayed in its cells. The CExtGridWnd class simply works with a data provider object (the CExtGridDataProvider-derived class) to obtain pointers to the CExtGridCell objects implementing grid cells. It is possible to assign different heights in pixels to each grid row but your code should measure the content of each row cell manually. Please provide us with more details about data contained in your grid window and we will help you with advice or a ready to use solution.

Osmin Lazo Jun 27, 2005 - 12:11 PM

What I need is a way to change the height of a row based on the contents of one of its cells. I can override CExtGridCellStringDM and change the drawing flags in OnQueryDrawTextFlags to have a multiline cell (memo style), but the row will keep its default height and the user would have to resize the row/height manually in order to see all lines in the multiline cell.


Is it possible to change the height of the row from the grid control so each row’s height is enough for the multiline cell to fully display its contents? I guess it would have to be from a grid control procedure that has access to a given row’s cells contents so it can check the amount of lines needed in the multiline cell and set the height of the row for it before is drawn or...


Thanks and let me know if this does not clarify the question. 

Technical Support Jun 29, 2005 - 2:59 AM

Of course, you can change any row height programmatically. If you need a variable row height in your grid control, insert at least one outer vertical header column because the grid control uses outer cells to keep information about each row height:

wndGrid.OuterColumnCountLeftSet( 1L, false );
That inserts one header column at left. To make this column hidden, set its width to zero:
wndGrid.OuterColumnWidthSet( true, 0L, 0 );
Then you need to insert header cells into this outer column when you insert each new row:
CExtGridCell * pCellHeaderAtLeft =
        wndGrid.GridCellGetOuterAtLeft(
            0L,
            nRowNo,
            RUNTIME_CLASS(
                CExtGridCellHeader
                )
            );
    ASSERT_VALID( pCellHeaderAtLeft );
Now you can set the row height:
pCellHeaderAtLeft->ExtentSet( nRowHeightInPixels );

Osmin Lazo Jun 29, 2005 - 9:33 AM

Thanks for your help. I’ll give this a try, sounds like the right solution... Thanks again.