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 » CExtGridWnd: how to resize last column to fit all left space Collapse All
Subject Author Date
Darius Mikalauskas Jan 25, 2008 - 7:09 AM

Hello,

I have CExtGridWnd object with two columns. I would like to set second column width to occupy all free space available in CExtGridWnd window.

Thank you.

Technical Support Jan 26, 2008 - 3:03 PM

The feature you need is called proportional column resizing. First of all, you should make your grid not using any scrolling strategy at all in horizontal direction. You should use the __ESIS_STH_NONE style instead of __ESIS_STH_PIXEL or __ESIS_STH_ITEM or __ESIS_STH_VIRTUAL styles in invocation of the SiwModifyStyle() method of your grid window. The __ESIS_STH_NONE style means not to use horizontal scrolling at all. You can also invoke the wndGrid.SiwScrollTypeHSet( __ESIW_ST_NONE ); code to disable horizontal scrolling. Next, you should allow proportional column resizing for your grid window by applying the __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS style using the CExtGridWnd::BseModifyStyleEx() method. Then, we assume you have initialized outer header row at the top side of your grid window with the CExtGridCellHeader grid cell objects. The header cells are supporting both minimal/current/maximal widths in pixels (pHeaderCell->ExtentSet()) and proportional sizes (pHeaderCell->ExtentPercentSet()). It all three cell widths in pixels are equal, then user will not be able to resize it and it will not be resized proportionally by the grid control when it will attempt to make all the columns occupying entire available widths. The proportional widths (pHeaderCell->ExtentPercentSet()) are floating point values. The summary floating point value of all the header cells will assumed as 100%. During horizontal resizing of the grid window its columns will be resized proportionally according their proportional width values. So, you can specify proportional widths of first column as pHeaderCell0->ExtentPercentSet(0.0) and proportional widths of second column as pHeaderCell1->ExtentPercentSet(1.0). This means only the second column will be resized automatically when the grid window will become resized horizontally.