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 » How to use "CExtGridWnd::BestFitColumn" Collapse All
Subject Author Date
Francesco Toscano Sep 3, 2007 - 9:37 AM

I have a Grid that uses a database source to fill the cells contet, I would like to use "CExtGridWnd::BestFitColumn" in order to fit the cell width according their content. Because The grid it is updated at every changes of the scrollbars, where is the right place to do use it, within the grids events?

I have tryed the follow:

bool CGridWnd::OnSiwCacheChanged(
    const CExtScrollItemCacheInfo & _sciNew,
    const CExtScrollItemCacheInfo & _sciOld
    )
{
    bool result = CExtGridWnd::OnSiwCacheChanged(_sciNew,_sciOld);

    LONG cols = ColumnCountGet();

    for(LONG col = 0; col < cols; col++)
        BestFitColumn(col, 0);

    return result;
}

in my derived grid window class, but it takes vary long times to be completed with large amount of data. What can I do?

Thanks in advance

Francesco Toscano

Technical Support Sep 3, 2007 - 11:38 AM

It is not a good idea to best fit a column with in virtually cacheable grids. In a memory grid you can do best fit by entire rows in a column or by visible rows only. But entire range cells are not available in a virtually cacheable grid. So, you can do best fit by visible rows only. Since a cacheable grid constantly updates cached cell range during scrolling, the content width of the visible cells in ca olumn can be constantly changing. We are not sure best fit is a good idea in these cases. You only have a reason to enable best fit by visible cells in column on header divider double click.