Tab-character is not shown by wxMessageBox on Windows 7

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
baralgin
In need of some credit
In need of some credit
Posts: 8
Joined: Mon Aug 23, 2010 10:41 am

Tab-character is not shown by wxMessageBox on Windows 7

Post by baralgin » Wed Dec 14, 2011 7:47 pm

The problem is that the following code:

Code: Select all

wxMessageBox("xxx\t\tyyy")
does not work correctly on Win7. Text is shown as "xxxyyy" without tabulation.

This code (binary) works perfectly under WinXP or Win7 with XP compatibility mode.

At the same time the following code (simple winapi program):

Code: Select all

int main()
{
MessageBox(0, L"xxx\t\tyyy", L"xxx", MB_OK);
}
works as expected (tabulation is shown).

So it looks like it is wxWidgets problem. Or I missed something?

PS: I am using last wxWidgets version (2.9.3, from trunk).

vid512
Experienced Solver
Experienced Solver
Posts: 52
Joined: Mon Feb 08, 2010 10:16 am

Re: Tab-character is not shown by wxMessageBox on Windows 7

Post by vid512 » Sun Jan 22, 2012 10:59 pm

This seems to be dependant upon which Common controls are selected in your manifest. If you edit your manifest and delete following entry from it, the "old style" controls appear:

Code: Select all

<assemblyIdentity type='win32'
name='Microsoft.Windows.Common-Controls'
version='6.0.0.0'
processorArchitecture='x86'
publicKeyToken='6595b64144ccf1df'
language='*' />
Note that this is better solution than setting compatibility mode, as that seems to make application noticeably slower. You can disable manifest generation completely by /MANIFEST:NO linker option.

What's interesting is that wx-2.8 seems to always display usual dialogs, even when this line is present in the manifest. It seems the 6.0 controls have to be explicitly enabled by the code first. There must have been some change related to InitCommonControlsEx() in src/msw/app.cpp between wx-2.8 and wx-2.9. However, looking at the code, I wasn't able to find the relevant difference.

Post Reply