wxDirDialog doesnt show window instead pauses the program

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.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDirDialog doesnt show window instead pauses the program

Post by ONEEYEMAN »

Hi,
Can you show the full event handler code and how do you catch it?

Thank you.
ibrahim
Earned some good credits
Earned some good credits
Posts: 124
Joined: Mon Mar 14, 2022 8:02 am

Re: wxDirDialog doesnt show window instead pauses the program

Post by ibrahim »

I followed the official instructions and it still didnt work
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxDirDialog doesnt show window instead pauses the program

Post by PB »

ibrahim wrote: Wed Mar 16, 2022 5:19 am I followed the official instructions and it still didnt work
Sorry, but this is useless. You were asked to provide full minimal reproducible code example, to make sure the whole code is correct, something simple like this:

Code: Select all

#include <wx/wx.h>
#include <wx/dirdlg.h>

class MyDialog : public wxDialog
{
public:
    MyDialog() : wxDialog(nullptr, wxID_ANY, "Test")
    {
        new wxButton(this, wxID_ANY, "Click me to show wxDirDialog...");
        Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { wxDirDialog(this).ShowModal(); });
    }
};

class MyApp : public wxApp
{
public:
    bool OnInit() override
    {
        MyDialog().ShowModal();
        return false;
    }
}; wxIMPLEMENT_APP(MyApp);
If the dialog works in such a simple example but not in your code, it would seem that the issue would not be in wxDirDialog but somewhere in your code which causes a seemingly unrelated issue.

You did not provide any information about the vcpkg install procedure, i.e., vcpkg and wxWidgets versions including port, the triplet, the compiler, whether you integrated the vcpgk install nor whether you had any previous wxWidgets installation. You even did not tell if you were running the Debug (can provide useful information in case of an issue) or Release configuration.

Moreover, you were also told that if there is an issue, i.e., you actually had a reproducible case, it must be reported to the vcpkg team as the vcpkg package is not maintained by the wxWidgets team.

With no information provided, except a suspect (modal dialog created on heap instead on stack) code fragment, you cannot realistically expect to be helped even if people tried their hardest.
ibrahim
Earned some good credits
Earned some good credits
Posts: 124
Joined: Mon Mar 14, 2022 8:02 am

Re: wxDirDialog doesnt show window instead pauses the program

Post by ibrahim »

@PB @ONEEYEMAN

Okay , I am back and this time I have a reproducable example :
Solution.zip
(3.6 KiB) Downloaded 29 times
Compile this with /clr (Common Lanaguage Runtime) or else is won't be reproduced ( I think I should've mentioned I was programming with C++ /CLI :mrgreen: )

The reason why the error wasn't showing up for you was because you didn't compile the program with /clr (Nodoby even knows C++ CLI with wxWidgets exists)

This was coded with wxWidgets 3.1.5 using Visual Studio 2022 on Windows 11.

For Those Of You who don't know what C++ /CLI is :

https://docs.microsoft.com/en-us/cpp/do ... w=msvc-170
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDirDialog doesnt show window instead pauses the program

Post by doublemax »

Although i have no experience with this, i would guess that you also need to rebuild the wx libraries with that setting.
Use the source, Luke!
ibrahim
Earned some good credits
Earned some good credits
Posts: 124
Joined: Mon Mar 14, 2022 8:02 am

Re: wxDirDialog doesnt show window instead pauses the program

Post by ibrahim »

I guess I can't use vcpkg's pre-built libraries then.

For A second I thought you were gonna say "wxWidgets doesnt support C++ CLI"
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDirDialog doesnt show window instead pauses the program

Post by doublemax »

ibrahim wrote: Wed May 18, 2022 4:08 pm For A second I thought you were gonna say "wxWidgets doesnt support C++ CLI"
Like i said, i know absolutely nothing about it. And what i suggested was only a guess. But worth trying.
Use the source, Luke!
ibrahim
Earned some good credits
Earned some good credits
Posts: 124
Joined: Mon Mar 14, 2022 8:02 am

Re: wxDirDialog doesnt show window instead pauses the program

Post by ibrahim »

:(

Okay

I have already installed the pre-built libraries with vcpkg.

How Do I Install the source code as well as the pre-built libraries. Isn't the "wx/" include header gonna have a duplicate??
Last edited by ibrahim on Wed May 18, 2022 4:29 pm, edited 1 time in total.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDirDialog doesnt show window instead pauses the program

Post by doublemax »

ibrahim wrote: Wed May 18, 2022 4:22 pm How Do I Install the source code as well as the pre-built libraries. Isn't the "wx/" include header gonna have a duplicate??
The source doesn't get "installed". Just extract the archive somewhere, build it and use the included "minimal" sample for a test. That won't change anything anywhere else.

Build without changing the clr setting first. Just so that you know everything works fine.
Use the source, Luke!
ibrahim
Earned some good credits
Earned some good credits
Posts: 124
Joined: Mon Mar 14, 2022 8:02 am

Re: wxDirDialog doesnt show window instead pauses the program

Post by ibrahim »

Oh alright
ibrahim
Earned some good credits
Earned some good credits
Posts: 124
Joined: Mon Mar 14, 2022 8:02 am

Re: wxDirDialog doesnt show window instead pauses the program

Post by ibrahim »

I've got the source and ran the "dialogs" sample , the dialogs is made natively ?? They don't look blurry like they do in my application
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxDirDialog doesnt show window instead pauses the program

Post by ONEEYEMAN »

Hi,
Yes, the dialog is native and it uses Manifest in order to support HighDPI.

Guess you program does not include the Manifest...

I also presume you tried 3.1.6 unmodified source, correct?

Thank you.
ibrahim
Earned some good credits
Earned some good credits
Posts: 124
Joined: Mon Mar 14, 2022 8:02 am

Re: wxDirDialog doesnt show window instead pauses the program

Post by ibrahim »

Yes , how do I use manifest too.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxDirDialog doesnt show window instead pauses the program

Post by doublemax »

ibrahim wrote: Thu May 19, 2022 5:44 am Yes , how do I use manifest too.
Either add <wxdir>/include/wx/msw/wx.rc to your project, or in VS, under Solution properties -> Manifest Tool -> Input and Output -> DPI Awareness
Use the source, Luke!
ibrahim
Earned some good credits
Earned some good credits
Posts: 124
Joined: Mon Mar 14, 2022 8:02 am

Re: wxDirDialog doesnt show window instead pauses the program

Post by ibrahim »

I have upgraded to 3.1.6 from vcpkg so I can try out the DPI stuff and it works with the samples !!
Last edited by ibrahim on Thu May 19, 2022 11:26 am, edited 2 times in total.
Post Reply