]> git.saurik.com Git - wxWidgets.git/commitdiff
Try to avoid truncation of the message in wxMSW wxMessageDialog.
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 20 Jan 2012 12:30:08 +0000 (12:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 20 Jan 2012 12:30:08 +0000 (12:30 +0000)
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

src/msw/msgdlg.cpp

index 3a8ace4806d0f9328122db40d25c5351fe78d22d..08b91774ce03800faa49f80d7e51aa10267ac936 100644 (file)
     #include "wx/msw/wince/missing.h"
 #endif
 
     #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)
 using namespace wxMSWMessageDialog;
 
 IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
@@ -680,7 +686,15 @@ wxMSWTaskDialogConfig::wxMSWTaskDialogConfig(const wxMessageDialogBase& dlg)
 
 void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc)
 {
 
 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();
 
     tdc.hInstance = wxGetInstance();
     tdc.pszWindowTitle = caption.wx_str();