Dir dialog not using the new windows style

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
redclad
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Apr 27, 2021 2:27 pm

Dir dialog not using the new windows style

Post by redclad »

Hello,

First of all:
Platform: windows 10
wxWidgets 3.1.4
Compiler: MinGW gcc-9.2
IDE: Code::Blocks 20.03

I implemented several buttons in a program GUI with wxWidgets including file pickers and a dir picker.
I also added the required resource file to use the native windows API.

Code: Select all

aaaa ICON "wx/msw/std.ico"

#include "wx/msw/wx.rc"
Everything that should use the native API does with the exception of the dir dialog.

I am not sure if the dir dialog that I see is the generic style or if it is the old windows style as described in the documentation.
Indeed is written in the documentation that two versions of the dir dialog exist in windows and that the wxDD_DEFAULT_STYLE should be used to ensure using the new windows version of dir dialog.
https://docs.wxwidgets.org/3.1.4/classw ... ialog.html

I tested all styles I could think of. They do change the style to some extend.
I tested using directly the wxDirPickerCtrl or using a custom button calling a wxDirDialog without any success.
I tested with a clean programs made with wxSmith or directly from code in Code::Block but I always have the same issue.
Image Image

Any help would be appreciated. :)
I apologize in advance if I forgot to mention something important to grasp the situation.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Dir dialog not using the new windows style

Post by ONEEYEMAN »

Hi,
MSW port uses an old style Windows 9x dialog.
There is a ticket about implementing a new style of the File/DirDialog for MSW. (Caution - it is very old).

You can look at it and see why it is not implemented yet.

Thank you.
redclad
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Apr 27, 2021 2:27 pm

Re: Dir dialog not using the new windows style

Post by redclad »

Thank you for the quick answer ONEEYEMAN.

I must have been mislead by examples on some websites showing the new dir dialog window like
https://www.wxishiko.com/wxWidgetsTutor ... ialog.html
https://www.wxishiko.com/wxWidgetsTutor ... rctrl.html

Yet, this topic on this forum has the opposite issue: the author wants the old style instead of the new style of dir dialog.
viewtopic.php?f=23&t=44407

So, I believe this new style must exist and be accessible through wxWidgets.

Did I misunderstood something ?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: Dir dialog not using the new windows style

Post by PB »

I implemented the new IFileDialog-based wxDirDialog in 2012 and it certainly is available in wxWidgets 3.1.4.

It is not compiled in if you have outdated mingw.org headers, which lack support for Windows Vista:
https://github.com/wxWidgets/wxWidgets/ ... lg.cpp#L48

I recommend using MinGW distribution which does not lack APIs for an OS released in 2007. AFAIK, project mingw-w64 has the most complete headers and libraries out of the mingw projects there. I recommend MSYS2 distribution, which is maintained and uses current mingw-w64 headers and reasonably updated GCC (currently at 10.2).

Be aware that 64-bit TDM-GCC 9.2 (which AFAIK has mingw-w64 headers) has a serious issue with wxWidgets, so I would not recommend this distribution, see e.g. here: viewtopic.php?f=1&t=46685
redclad
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Apr 27, 2021 2:27 pm

Re: Dir dialog not using the new windows style

Post by redclad »

PB wrote: Fri Apr 30, 2021 4:04 pm I implemented the new IFileDialog-based wxDirDialog in 2012 and it certainly is available in wxWidgets 3.1.4.

It is not compiled in if you have outdated mingw.org headers, which lack support for Windows Vista:
https://github.com/wxWidgets/wxWidgets/ ... lg.cpp#L48

I recommend using MinGW distribution which does not lack APIs for an OS released in 2007. AFAIK, project mingw-w64 has the most complete headers and libraries out of the mingw projects there. I recommend MSYS2 distribution, which is maintained and uses current mingw-w64 headers and reasonably updated GCC (currently at 10.2).

Be aware that 64-bit TDM-GCC 9.2 (which AFAIK has mingw-w64 headers) has a serious issue with wxWidgets, so I would not recommend this distribution, see e.g. here: viewtopic.php?f=1&t=46685
Indeed, it could simply be an issue related to the recognized version of windows. As explained in dirdlg.cpp, wxWidgets will only use the newer dir dialog version for windows versions after vista.

I installed the newest version of mingw-w64 from MSYS2 as you suggested, recompiled wxWidgets with it (I went for the newer version 3.1.5 for the occasion), but the issue persists.
Any other clue or idea to solve this issue ?

I noticed that the manifest files provided in wfWidgets indicates version 6.0.0.0 of windows (so vista). (like in \include\wx\msw\wx.manifest ).
This does seem to be the default file so I don't think the issue would come from that or I wouldn't be the only one encountering it, right ?
Here is the wx.manifest file I got with wxWidgets:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="0.64.1.0"
    processorArchitecture="x86"
    name="Controls"
    type="win32"
/>
<description>wxWidgets application</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>

EDIT:
Well, now with the updated versions, if I wrote a different default path for the wxDirPickerCtrl, the new dir dialog version was used.

So we can consider the problem solved.
Thank you for your help.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7449
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Dir dialog not using the new windows style

Post by ONEEYEMAN »

Hi,
What was the original path and what did you change it to?

Thank you.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: Dir dialog not using the new windows style

Post by PB »

redclad wrote: Sat May 01, 2021 5:57 am I noticed that the manifest files provided in wfWidgets indicates version 6.0.0.0 of windows (so vista). (like in \include\wx\msw\wx.manifest ).
This is not version of Windows, but the version of the common controls library. IIRC, 6.0 indicates Windows XP which introduced theming and new common controls. Windows version compatibility is declared only in the dpi-aware manifests, like this

Code: Select all

  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!-- Windows Vista -->
      <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
BTW, the new dialog is used by wxWidgets only on Win7 and newer as Vista had some bugs with it (which are probably fixed by now, back then MS released only a hotfix).
redclad wrote: Sat May 01, 2021 5:57 am Well, now with the updated versions, if I wrote a different default path for the wxDirPickerCtrl, the new dir dialog version was used.
Oopps, you are right. If one uses a path with an invalid drive, e.g., "x:\" the old dialog is shown. The new dialog is still shown for invalid paths on valid drives (e.g., "c:\NotExists"). This is because Windows returns an error when constructing a dialog with invalid path so wxWidgets thinks there is an issue with the new dialog and reverts to the old one. I thought it was fixed, I will look into it. Thanks for the report.

EDIT
I have just suggested a fix in this PR: https://github.com/wxWidgets/wxWidgets/pull/2356

EDIT 2
The fix was merged: https://github.com/wxWidgets/wxWidgets/ ... b51edb311f
redclad
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Apr 27, 2021 2:27 pm

Re: Dir dialog not using the new windows style

Post by redclad »

ONEEYEMAN wrote: Sat May 01, 2021 6:23 am Hi,
What was the original path and what did you change it to?

Thank you.
The original path I set was simply "." for the need of the program. The new one that works is an empty string.

Note that with my previous wxWidgets built from MinGW gcc-9.2, neither valid nor invalid path led to the new dir dialog version. So the suggestion to compile wxWidgets with another compiler did solve the issue.
PB wrote: Sat May 01, 2021 6:42 am Oopps, you are right. If one uses a path with an invalid drive, e.g., "x:\" the old dialog is shown. The new dialog is still shown for invalid paths on valid drives (e.g., "c:\NotExists"). This is because Windows returns an error when constructing a dialog with invalid path so wxWidgets thinks there is an issue with the new dialog and reverts to the old one. I thought it was fixed, I will look into it. Thanks for the report.

EDIT
I have just suggested a fix in this PR: https://github.com/wxWidgets/wxWidgets/pull/2356

EDIT 2
The fix was merged: https://github.com/wxWidgets/wxWidgets/ ... b51edb311f
I am glad that I didn't directly solve the issue myself if reporting it here helped improve wxWidgets. ^^

On a side note: the spam filter of this forum is extreme. It's so difficult to post a simple message such as this one. I hope it is not preventing others from asking questions or simply replying. :lol:
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: Dir dialog not using the new windows style

Post by PB »

redclad wrote: Sun May 02, 2021 7:33 pm On a side note: the spam filter of this forum is extreme.
I have never had problems with that nor did I see other complaints. However, I have an old account and it could be possible that spam filter misbehaves so much that one cannot even complain about it...

I would report this in the General Forum Issues section, the moderators should be able to see rejected posts and see how many of those are actually not spam...
User avatar
doublemax
Moderator
Moderator
Posts: 19102
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Dir dialog not using the new windows style

Post by doublemax »

PB wrote: Sun May 02, 2021 8:17 pm I would report this in the General Forum Issues section, the moderators should be able to see rejected posts and see how many of those are actually not spam...
Unfortunately not. The forum software rejects a message when you try to submit it, i don't think that shows up anywhere - at least not that i'm aware of.

But i think the number of URLs in a post is one of the criteria whether a post is considered spam. So removing them should help.
Use the source, Luke!
Post Reply