X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c1285bb5b9eb68043d782f88f732353e1d2a718..e7300ec6d9ebbd1cfa2fcf12c0ce6e5aee85a152:/src/msw/button.cpp?ds=sidebyside diff --git a/src/msw/button.cpp b/src/msw/button.cpp index 5cb83273d7..2cafeca17e 100644 --- a/src/msw/button.cpp +++ b/src/msw/button.cpp @@ -71,7 +71,24 @@ bool wxButton::Create(wxWindow *parent, if ( !CreateControl(parent, id, pos, size, style, validator, name) ) return FALSE; - return MSWCreateControl(_T("BUTTON"), label, pos, size, style); + WXDWORD exstyle; + WXDWORD msStyle = MSWGetStyle(style, &exstyle); + +#ifdef __WIN32__ + // if the label contains several lines we must explicitly tell the button + // about it or it wouldn't draw it correctly ("\n"s would just appear as + // black boxes) + // + // NB: we do it here and not in MSWGetStyle() because we need the label + // value and m_label is not set yet when MSWGetStyle() is called; + // besides changing BS_MULTILINE during run-time is pointless anyhow + if ( label.find(_T('\n')) != wxString::npos ) + { + msStyle |= BS_MULTILINE; + } +#endif // __WIN32__ + + return MSWCreateControl(_T("BUTTON"), msStyle, pos, size, label, exstyle); } wxButton::~wxButton()