From 083ec26fb723d360851f2842ffb5fb3c65a8797b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 15 Aug 2012 23:34:40 +0000 Subject: [PATCH] Fix bug in ribbon bar label size calculation. Due to an off by 1 error in wxString::Mid() call, the size computed was too small and hence the label could have been not displayed at all. Fix this and also replace Mid(0, n) with a more clear Left(n) call. Closes #14566. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72348 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/ribbon/art_msw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ribbon/art_msw.cpp b/src/ribbon/art_msw.cpp index 0484c51b98..9318b309c2 100644 --- a/src/ribbon/art_msw.cpp +++ b/src/ribbon/art_msw.cpp @@ -2889,7 +2889,7 @@ bool wxRibbonMSWArtProvider::GetButtonBarButtonSize( if(wxRibbonCanLabelBreakAtPosition(label, i)) { int width = wxMax( - dc.GetTextExtent(label.Mid(0, i - 1)).GetWidth(), + dc.GetTextExtent(label.Left(i)).GetWidth(), dc.GetTextExtent(label.Mid(i + 1)).GetWidth() + last_line_extra_width); if(width < best_width) {