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 » __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS Collapse All
Subject Author Date
Christoffer Buchhorn Feb 14, 2007 - 5:49 AM

Hi,

I would like to rezise the columns automatically so the grid window is filled completely. Your help states how to do it, but I can’t make it work. Furthermore you refer to the Report Grid sample. It does not use the proposed solution at all. Could you try to show how to do it in the ProfUIS_Controls sample?

I am using CExtGridWnd.

Suhai Gyorgy Feb 14, 2007 - 7:12 AM

Here’s how it can be done with ProfUIS_Controls sample. I’m reducing the number of columns to 3 to make the change more obvious.

- Inside CPageGrid::OnInitDialog, look for the struct arrHeader. Right before declaration of this struct, add the lines:

	m_wndGrid.SiwScrollTypeHSet( __ESIW_ST_NONE, false );
	m_wndGrid.BseModifyStyleEx( __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS, 0, false );

- The declaration of the struct is LPCTSTR sText; INT nWidth; DWORD dwStyle;, make it LPCTSTR sText; double nWidth; DWORD dwStyle; (changing INT to double).
- Comment all items of the struct except for the first 3 (Boolean, CheckBox, RadioButton).
- Change the widths from 85, 85, 85 to 0.5, 0.25, 0.25 .
- Right after this struct there’s a loop to initialize all the headers on the top. Inside the loop there’s a call pCell->ExtentSet( arrHeader[nColNo].nWidth );, change this to pCell->ExtentPercentSet( arrHeader[nColNo].nWidth );.
- Look for a series of calls _InitColumn.... Comment all except for the first 3.
- Rebuild, run. You will see the 3 columns taking up all the width of the grid. Try resizing the window, columns are resizing accordingly.

Actually the first step is enough to show the effect of style __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS, but all the columns would be very narrow.