From: Vadim Zeitlin Date: Fri, 20 Jan 2012 12:30:08 +0000 (+0000) Subject: Try to avoid truncation of the message in wxMSW wxMessageDialog. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/5f519da23d582da30a0d7894d330198c673400d6 Try to avoid truncation of the message in wxMSW wxMessageDialog. Use (documented but undefined) TDF_SIZE_TO_CONTENT flag under Windows Vista/7 to reduce the chance that Windows truncates or ellipsizes the message text if it can't wrap it. Truncation can still happen for very long words but there doesn't seem to be any drawbacks to using TDF_SIZE_TO_CONTENT and it does avoid truncation in at least some cases. This also improves the situation for wxRichMessageDialog and wxProgressDialog. Closes #13843. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70409 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/msgdlg.cpp b/src/msw/msgdlg.cpp index 3a8ace4806..08b91774ce 100644 --- a/src/msw/msgdlg.cpp +++ b/src/msw/msgdlg.cpp @@ -54,6 +54,12 @@ #include "wx/msw/wince/missing.h" #endif +// Interestingly, this symbol currently seems to be absent from Platform SDK +// headers but it is documented at MSDN. +#ifndef TDF_SIZE_TO_CONTENT + #define TDF_SIZE_TO_CONTENT 0x1000000 +#endif + using namespace wxMSWMessageDialog; IMPLEMENT_CLASS(wxMessageDialog, wxDialog) @@ -680,7 +686,15 @@ wxMSWTaskDialogConfig::wxMSWTaskDialogConfig(const wxMessageDialogBase& dlg) void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc) { - tdc.dwFlags = TDF_EXPAND_FOOTER_AREA | TDF_POSITION_RELATIVE_TO_WINDOW; + // Use TDF_SIZE_TO_CONTENT to try to prevent Windows from truncating or + // ellipsizing the message text. This doesn't always work as Windows will + // still do it if the message contains too long "words" (i.e. runs of the + // text without spaces) but at least it ensures that the message text is + // fully shown for reasonably-sized words whereas without it using almost + // any file system path in a message box would result in truncation. + tdc.dwFlags = TDF_EXPAND_FOOTER_AREA | + TDF_POSITION_RELATIVE_TO_WINDOW | + TDF_SIZE_TO_CONTENT; tdc.hInstance = wxGetInstance(); tdc.pszWindowTitle = caption.wx_str();