widthAvailable -= extraWidth*(count - 1); // extra space between fields
widthAvailable -= MSWGetMetrics().textMargin; // and for the last field
- if ( HasFlag(wxSTB_SIZEGRIP) )
- widthAvailable -= MSWGetMetrics().gripWidth;
+ // Deal with the grip: we shouldn't overflow onto the space occupied by it
+ // so the effectively available space is smaller.
+ const int gripWidth = HasFlag(wxSTB_SIZEGRIP) ? MSWGetMetrics().gripWidth
+ : 0;
+ widthAvailable -= gripWidth;
// distribute the available space (client width) among the various fields:
pWidths[i] = nCurPos;
}
+ // The total width of the panes passed to Windows must be equal to the
+ // total width available, including the grip. Otherwise we get an extra
+ // separator line just before it.
+ pWidths[count - 1] += gripWidth;
+
if ( !StatusBar_SetParts(GetHwnd(), count, pWidths) )
{
wxLogLastError("StatusBar_SetParts");
wxCopyRECTToRect(r, rect);
- // Windows seems to under-report the size of the last field rectangle,
- // presumably in order to prevent the buggy applications from overflowing
- // onto the size grip but we want to return the real size to wx users
- if ( HasFlag(wxSTB_SIZEGRIP) && i == (int)m_panes.GetCount() - 1 )
- {
- rect.width += MSWGetMetrics().gripWidth - MSWGetBorderWidth();
- }
-
return true;
}