[wxMac 2.8x] wxWindow::DoGetBestSize bug still not solved
Vadim Zeitlin
vadim at wxwindows.org
Sun Apr 15 14:11:46 PDT 2007
On Sun, 15 Apr 2007 22:56:18 +0200 H <H at h.com> wrote:
H> GetSize() returns (0, 0) from the system if the window is not shown on
H> the screen. It does not matter whether the window has got children
H> (scrollbars) or not.
Surely this is not normal, is it? Do you mean it's a known Mac limitation
which can't be fixed? From my (Mac-ignorant) point of view this is a rather
bad bug, if true.
H> I did not say that there is a bug in GetSize(). GetSize() is fine and
H> does what it should do.
Sorry, I'm getting confusier and confusier. If GetSize() returns (0, 0)
for hidden windows it *definitely* isn't fine. So which one is it?
H> DoGetBestSize() is the problem (or GetClientSize())!
I'm sorry but I'm pretty sure that if GetSize() returns (0, 0) (for
whatever reason) this is the problem and nothing you can do in
DoGetBestSize() can help.
H> // Add any difference between size and client size
H> wxSize diff = GetSize() - GetClientSize();
H> best.x += wxMax(0, diff.x);
H> best.y += wxMax(0, diff.y);
As proof, consider that if GetSize() returns (0, 0) the code above will
never add anything at all to "best". Of course, this also assumes that
GetClientSize() behaves correctly, which doesn't seem to be the case, see
below.
H> For this solution I need the confirmation that GetClientSize() always
H> returns values larger or equal to zero!
Of course it should always return positive values.
H> Personally, I prefer to modify DoGetBestSize because it needs an
H> overhaul anyway and it assumes that GetClientSize() returns negative
H> values
Sorry, it doesn't assume anything like this. But I guess I see what you
mean now... You say that "diff" above is negative and hence "best" comes
out correctly, right? But, if so, this is a total fluke and it was never
intended to work like this.
Once again:
1. If GetSize() returns (0, 0) for a window with scrollbars this is a bug.
2. Independently of this discussion, calling InvalidateBestSize() in
DoInsertItem() should help with wxTreebook problem
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
More information about the wx-users
mailing list