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 » Grid specific column width to fill window Collapse All
Subject Author Date
Offer Har Nov 7, 2008 - 10:19 AM

I have a grid with X columns, each one have an initial width.


I need to change the width of one of the columns (only one, and not always the last one) when the window width changes.


Can this be done?


Thanks.

Technical Support Nov 10, 2008 - 11:51 AM

Yes, you are right. But, if you want one or more columns to be automatically resized when the grid window’s width changes, you should turn off horizontal scrolling. Otherwise automatic resizing of grid columns cannot be done.

You can leave all the other columns resizable by the user in your grid window. You should not set equal the minimal/current/maximal size for all other columns. But you should set their proportional extent to zero.

Offer Har Nov 17, 2008 - 7:26 PM

OK - got it - it was ExtentPercentSet and not ExtentSet.


Works very nice

Offer Har Nov 17, 2008 - 7:19 PM

I tried it and it did not work - this is what I tried to do:


I have a grid with 3 columns, and I want the last column’s size to change when the winodw is resized, and that the first two columns will left as-is.


As you suggested I did this:



        SiwModifyStyle(__ESIS_STH_NONE,__ESIS_STH_PIXEL);
        BseModifyStyleEx( __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS);

        for (int i=0; i<(ColumnCountGet()-1); i++)
        {
            CExtGridCellHeaderChecked* pCell = 
                (CExtGridCellHeaderChecked*)GridCellGetOuterAtTop(i, 0);

            pCell->ExtentSet(0.0);
        }

        CExtGridCellHeaderChecked* pCell = 
            (CExtGridCellHeaderChecked*)GridCellGetOuterAtTop(ColumnCountGet()-1, 0);
        pCell->ExtentSet(1.0);

But, only the last column is visible now, and it occupy the whole grid.


What am I missing?


Thanks,


Ron.


 

Offer Har Nov 10, 2008 - 4:04 PM

Wait - so I can do it without the call to ExtentSet to all the other columns?  Now I am confused......

Technical Support Nov 11, 2008 - 9:25 AM

Use the CExtGridCell::ExtentSet() method for all header cells in order to set a column width. Do not invoke this method for any of header cells for limiting minimal or maximal column widths. Now grid columns have some initial widths in pixels. The next step is to assign proportional extents to them. Please invoke the CExtGridCell::ExtentPercentSet() method for all columns. You should set a 0.0 proportional extent to all the columns but one of them. This one column needs the 1.0 proportional extent. As a result, only one column will be automatically resized during grid resizing.

Technical Support Nov 7, 2008 - 3:19 PM

This task can be done automatically if the grid window does not use horizontal scrolling (the __ESIS_STH_NONE style is specified in invocation of grid’s SiwModifyStyle() method) and proportion resizing feature for columns (the __EGBS_BSE_EX_PROPORTIONAL_COLUMN_WIDTHS style is specified in invocation of grid’s BseModifyStyleEx() method). If you need only the one column to be automatically resizable, then all the other columns should have equal minimal and maximal width in pixels. This means you should invoke pHeaderCell->ExtentSet( nSomeWidth, -1 ); pHeaderCell->ExtentSet( nSomeWidth, 0 ); pHeaderCell->ExtentSet( nSomeWidth, 0 ); code for all the header cells in all the fixed size columns and you should not invoke this code only for one column which will be automatically resized. This automatically resized column can be any of your grid’s columns.

Offer Har Nov 7, 2008 - 3:23 PM

What you say is this:


1) No horizontal scroll bar


2) No column width can be changed but the one I want to be changed when the width of the window changes


These are too much contsrtains and cannot work for me. Why are these constrains needed?