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 » CExtTreeGrid and BestFitColumn() Collapse All
Subject Author Date
Andrey Karavashkin Nov 23, 2006 - 4:20 AM

Function BestFitColumn (defined in CExtGridWnd) works incorrect for CExtTreeGridWnd.

1. For first column - left extend (for tree lines) is not consider in column width calculation.

2. BestFitColumn finction parameter bDoBestFitByVisibleRowRangeOnly (false as default) doesn’t works. All Sub items of _unexpanded_ item is ignored in column width calculation

Technical Support Nov 23, 2006 - 10:29 AM

We agree that the best fit actually works as you described but we do not think the current implementation of this feature is buggy. You could specify a minimum width for the header column (tree outline), in pixels, to avoid these problems. Both best fitting and proportional resizing will work properly for such a column and there will be no problem with the outline

Andrey Karavashkin Nov 25, 2006 - 3:06 PM

Can’t agree with you.

Default behavior of BestFitColumn() function in CExtGridWnd - resize column to size of longest cell. The absolutely same bahavior must be in CExtTreeGridWnd. If there is no additional manipulation with cells required to best fit column in CExtGridWnd, why those manipulation required in CExtTreeGridWnd ?????

About recomended workaroud. [QUOTE: You could specify a minimum width for the header column]
CExtGridCellHeader* pHeaderCell = (CExtGridCellHeader*)m_grd.GridCellGetOuterAtTop(0, 0,RUNTIME_CLASS(CExtGridCellHeader));
pHeaderCell->ExtentSet( 18, -1 );
It doesn’t works. Minimum width for header column - is just a _minimum_width_, no more. With minimal width, user can’t set column width less, than specified. But there is no correlation between _minimum_width_ and BestFitColumn().


Also, I found that
pHeaderCell->ExtraSpaceSet( 18, false );
has strange effect in CExtTreeGridWnd. At code above, I add free 18 pixel space at left of grid (before first column). After that, BestFitColumn() increase column size for 18 pixels!! But if you’ll see to grid, column size is was not changed!! Only empty space _before_ column was added.
Try to pHeaderCell->ExtraSpaceSet( 180, false ) and you will see, that BestFitColumn() will resize column with about 180 free white pixels after end of content of longest cell.



IMHO, CExtTreeGridWnd should has own version of BestFitColumn(), because tree outline size different in diferrent depth...
Cell with very short text at depth-20 can be longer that cell with grid-wide-lognest-text at depth-1, isn’t it?

Technical Support Nov 28, 2006 - 8:43 AM

We agree with you that the tree window should have its specific best fitting algorithm. However in some cases, like a very deep level of expanded rows, the best fitting is not applicable at all, especially if the proportional resizing is turned on and all the columns are stretched to the client area’s width. Besides, the tree grid window can display outline in any column and in more than one column at the same time. Please let us know when you need this feature (how urgent it is)?

Andrey Karavashkin Dec 7, 2006 - 3:18 PM

I’m really sorry, for long delay with answer.

What about my needs - I only need workaround for BestFitColumn() issue in CextTreeGrid.
As far as I understand, in my case, I just need to override function, that calculates cell with, and just add 18*depth_level pixels to width, isn’t it?
(there is no proportional resize, outlines only in first column, only text cells in first column).


Also, I need to know how to show/hide tree outlines? (in some cases TreeGrid is not necessary at this time, but it will be very usefull in future extetions)
And is it possible to have outlines in second (or other) column instead of default first.
I found no any information about it in help.

Technical Support Dec 13, 2006 - 6:25 AM

Yes, you can implement the custom best fitting in that way.

The CExtTreeGridWnd::OnTreeGridQueryDrawOutline() virtual method is invoked to detect which column(s) display the tree outline. It is possible to hide the outline at all, display it for any column or even for several columns. The CExtGridBaseWnd::OnGbwPaintCell() virtual method is implemented in the CExtTreeGridWnd class and performs outline painting. You should override this method to repaint the tree outline and use the source code of the CExtTreeGridWnd ::OnGbwPaintCell() method as a sample.