[2.8.0] wxTreebook bug

H H at h.com
Sat Mar 24 05:08:35 PDT 2007


In article <H-CB6302.12321424032007 at news.wanadoo.nl>, H <H at h.com> 
wrote:

> I while ago I have reported a wxTreebook bug that can be seen in the 
> notebook sample when switching initially from the standard notebook to a 
> treebook: the control window and the page window overlap.
> I have now tracked down the cause of the problem - I tracked it down 
> only for the generic implementation - and would like to ask you if the 
> following solution is acceptable (then, I will submit the patch):
> The generic treebook implementation uses the generic tree control. When 
> initializing the generic tree control 'DoGetBestSize()' is called to 
> determine initially the best size. This function returns for default 
> sizes the values (12, 12) - at least on the Mac. But this calculation is 
> NOT taking into consideration that also sliders are initially present. 
> On the Mac - and I think also on other platforms - this means that the 
> control's client size becomes negative. And this messes everything up.
> So, the easiest solution is to modify wxGenericTreeCtrl::DoGetBestSize 
> to take sliders into account when they are present. Does this cause any 
> problems anywhere (please keep in mind that when the sliders are removed 
> later the best size is still the size with the sliders as the original 
> size is saved)?
> If wxGenericTreeCtrl::DoGetBestSize cannot be patched like mentioned 
> above wxTreebook itself has to be patched.
> 
> Hartwig

Actually, I just found out that the source of this bug is even at 
wxWindowBase::DoGetBestSize() and it seems to be a Mac bug only: If a 
window does not have a sizer, constraints or "real" children wxSize(0, 
0) is returned. "Real" children are all children but not scrollbars.
And these scrollbars cause the problem in the generic tree control 
because the generic tree control expects to have the size of the 
scrollbars included in the window's size calculation.

Why does wxWindowBase::DoGetBestSize() return wxSize(0,0) (ONLY for the 
Mac) if there are only sliders (scrollbars) present??

What shall I patch, wxWindowBase, wxTreeBase, wxGenericTreeCtrl or 
wxTreebook?

Hartwig






More information about the wx-users mailing list