wxwidgets Buttons fail to work on macOS Tahoe (Issue #26407)

65 views
Skip to first unread message

Kyle Kenney

unread,
Apr 25, 2026, 11:29:51 AMApr 25
to wx-...@googlegroups.com, Subscribed
kapton-marvel created an issue (wxWidgets/wxWidgets#26407)

Description

you use:
  • wxWidgets port you use:
  • OS and its version: macOS Tahoe


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407@github.com>

VZ

unread,
Apr 25, 2026, 11:37:58 AMApr 25
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26407)

Sorry, I have no idea how could this depend on the platform (SDK?) being used and I'm also pretty sure that this works for other people using macOS Tahoe (I don't have it myself yet, so I can't check).

I suspect that this could be some rebuild problem. Please try debugging this, e.g. check if wxButton::OSXHandleClicked() is being called at all.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4319967328@github.com>

Kyle Kenney

unread,
May 7, 2026, 1:25:25 PMMay 7
to wx-...@googlegroups.com, Subscribed
kapton-marvel left a comment (wxWidgets/wxWidgets#26407)

Thanks for your comment, I could get the code to work if I using the generic file diaglog, in this example:

#include <wx/wx.h>
#include <wx/image.h>
#include <wx/generic/filedlgg.h>

class ImagePanel : public wxPanel {
public:
    ImagePanel(wxWindow* parent) : wxPanel(parent) {
        Bind(wxEVT_PAINT, &ImagePanel::OnPaint, this);
    }

    void LoadImage(const wxString& path) {
        wxImage img;
        if (img.LoadFile(path)) {
            m_bitmap = wxBitmap(img);
            Refresh();
        }
    }

private:
    void OnPaint(wxPaintEvent&) {
        wxPaintDC dc(this);
        if (m_bitmap.IsOk())
            dc.DrawBitmap(m_bitmap, 0, 0, false);
    }

    wxBitmap m_bitmap;
};

class MainFrame : public wxFrame {
public:
    MainFrame() : wxFrame(nullptr, wxID_ANY, "Image Viewer", wxDefaultPosition, wxSize(800, 600)) {
        auto* fileMenu = new wxMenu;
        fileMenu->Append(wxID_OPEN, "&Open Image...\tCmd+O");
        auto* menuBar = new wxMenuBar;
        menuBar->Append(fileMenu, "&File");
        SetMenuBar(menuBar);
        Bind(wxEVT_MENU, &MainFrame::OnOpenImage, this, wxID_OPEN);

        auto* sizer = new wxBoxSizer(wxVERTICAL);
        auto* btn = new wxButton(this, wxID_ANY, "Open Image");
        btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) { OnOpenImage(); });

        m_panel = new ImagePanel(this);
        sizer->Add(btn, 0, wxALL, 8);
        sizer->Add(m_panel, 1, wxEXPAND);
        SetSizer(sizer);
    }

private:
    void OnOpenImage(wxCommandEvent&) { OnOpenImage(); }

    void OnOpenImage() {
        wxGenericFileDialog dlg(this, "Open Image", wxEmptyString, wxEmptyString,
            "Image files (*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff)"
            "|*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff",
            wxFD_OPEN | wxFD_FILE_MUST_EXIST);
        if (dlg.ShowModal() == wxID_OK)
            m_panel->LoadImage(dlg.GetPath());
    }

    ImagePanel* m_panel;
};

class App : public wxApp {
public:
    bool OnInit() override {
        wxInitAllImageHandlers();
        (new MainFrame())->Show();
        return true;
    }
};

wxIMPLEMENT_APP(App);

This isn't an elegant solution as it uses the generic file dialog, which is pretty bad overall on Tahoe. To ensure that this isn't a bad build or stale or something, I completely delete the build directory, refetch wxwidgets completely, and recompile via:

Trying your suggestion, I get:
Using the following code:

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

class ImagePanel : public wxPanel {
public:
    ImagePanel(wxWindow* parent) : wxPanel(parent) {
        Bind(wxEVT_PAINT, &ImagePanel::OnPaint, this);
    }

    void LoadImage(const wxString& path) {
        wxImage img;
        if (img.LoadFile(path)) {
            m_bitmap = wxBitmap(img);
            Refresh();
        }
    }

private:
    void OnPaint(wxPaintEvent&) {
        wxPaintDC dc(this);
        if (m_bitmap.IsOk())
            dc.DrawBitmap(m_bitmap, 0, 0, false);
    }

    wxBitmap m_bitmap;
};

class MainFrame : public wxFrame {
public:
    MainFrame() : wxFrame(nullptr, wxID_ANY, "Image Viewer", wxDefaultPosition, wxSize(800, 600)) {
        auto* fileMenu = new wxMenu;
        fileMenu->Append(wxID_OPEN, "&Open Image...\tCmd+O");
        auto* menuBar = new wxMenuBar;
        menuBar->Append(fileMenu, "&File");
        SetMenuBar(menuBar);
        Bind(wxEVT_MENU, &MainFrame::OnOpenImage, this, wxID_OPEN);

        auto* sizer = new wxBoxSizer(wxVERTICAL);
        auto* btn = new wxButton(this, wxID_ANY, "Open Image");
        btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
            fprintf(stderr, "OSXHandleClicked fired — button event reached wx handler\n");
            OnOpenImage();
        });

        m_panel = new ImagePanel(this);
        sizer->Add(btn, 0, wxALL, 8);
        sizer->Add(m_panel, 1, wxEXPAND);
        SetSizer(sizer);
    }

private:
    void OnOpenImage(wxCommandEvent&) { OnOpenImage(); }

    void OnOpenImage() {
        wxFileDialog dlg(this, "Open Image", wxEmptyString, wxEmptyString,
            "Image files (*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff)"
            "|*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff",
            wxFD_OPEN | wxFD_FILE_MUST_EXIST);
        if (dlg.ShowModal() == wxID_OK)
            m_panel->LoadImage(dlg.GetPath());
    }

    ImagePanel* m_panel;
};

class App : public wxApp {
public:
    bool OnInit() override {
        wxInitAllImageHandlers();
        (new MainFrame())->Show();
        return true;
    }
};

wxIMPLEMENT_APP(App);

I get the following results.

kapton-marvel@MacOS % ./wxbuttons
OSXHandleClicked fired — button event reached wx handler

However, the button does not work. I completely deleted the build folder and refetch/recompile the program from scratch with:

rm -rf build && mkdir build && cd build && cmake .. && cmake --build .


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4399453609@github.com>

VZ

unread,
May 8, 2026, 9:22:03 AMMay 8
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26407)

So, if I understand it correctly, the buttons work perfectly fine and it's showing the (native) file dialog which doesn't work for you, right?

If so, there have been a few bugs in this code, but they were all supposed to be fixed and none of them resulted in the dialog not being shown at all AFAIR. Which wxWidgets version do you use?


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4406738550@github.com>

Kyle Kenney

unread,
May 8, 2026, 10:44:16 AMMay 8
to wx-...@googlegroups.com, Subscribed
kapton-marvel left a comment (wxWidgets/wxWidgets#26407)

The compiled programs, i wrote in the past, for older versions of macOS < 26.4.1 , the buttons and functions all work perfectly, including the initial example code in this post.

If I recompile the above example program on 26.4.1 macOS. I could only get the filedialog to show up if I used wxGenericFileDialog in the above example code.

I am using wxwidgets v3.3.2.

Thanks again for the help, I hope my problem is clearer


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4407328553@github.com>

VZ

unread,
May 8, 2026, 10:59:50 AMMay 8
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26407)

No, sorry, it's not clear. It's clear that something has changed after recompiling it, but it's still not completely clear what: you seem to think that button clicks are not taken into account, but if your OnOpenImage() is called at all, as it must be for the generic dialog to be shown, it means that they are. So the problem must be that wxFileDialog::ShowModal() doesn't show the dialog and not what you think.

You can check whether that this is indeed the case by calling it from a menu event handler, for example.


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4407430017@github.com>

Kyle Kenney

unread,
May 8, 2026, 11:53:47 AMMay 8
to wx-...@googlegroups.com, Subscribed
kapton-marvel left a comment (wxWidgets/wxWidgets#26407)

Yes you're correct, it seems to be something wrong with the ShowModal().

I have updated the code with your suggestion and recompiled:

class MainFrame : public wxFrame {
public:
    MainFrame() : wxFrame(nullptr, wxID_ANY, "Image Viewer", wxDefaultPosition, wxSize(800, 600)) {
        auto* fileMenu = new wxMenu;
        fileMenu->Append(wxID_OPEN, "&Open Image...\tCmd+O");
        auto* menuBar = new wxMenuBar;
        menuBar->Append(fileMenu, "&File");
        SetMenuBar(menuBar);
        Bind(wxEVT_MENU, &MainFrame::OnOpenImage, this, wxID_OPEN);

        auto* sizer = new wxBoxSizer(wxVERTICAL);
        auto* btn = new wxButton(this, wxID_ANY, "Open Image");
        btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
            fprintf(stderr, "OSXHandleClicked fired — button event reached wx handler\n");
            OnOpenImage();
        });

        m_panel = new ImagePanel(this);
        sizer->Add(btn, 0, wxALL, 8);
        sizer->Add(m_panel, 1, wxEXPAND);
        SetSizer(sizer);
    }

private:
    void OnOpenImage(wxCommandEvent&) {
        fprintf(stderr, "OnOpenImage(wxCommandEvent) — menu/event path\n");
        OnOpenImage();
    }

    void OnOpenImage() {
        fprintf(stderr, "OnOpenImage() entered\n");
        wxFileDialog dlg(this, "Open Image", wxEmptyString, wxEmptyString,
            "Image files (*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff)"
            "|*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff",
            wxFD_OPEN | wxFD_FILE_MUST_EXIST);
        fprintf(stderr, "wxFileDialog constructed, calling ShowModal()\n");
        int result = dlg.ShowModal();
        fprintf(stderr, "ShowModal() returned: %d (wxID_OK=%d, wxID_CANCEL=%d)\n", result, wxID_OK, wxID_CANCEL);
        if (result == wxID_OK)
            m_panel->LoadImage(dlg.GetPath());
    }

    ImagePanel* m_panel;
};

of which i ran this program in terminal and get the following results, when I click the button, or use the drop down menu, or hit the key "o" respectively, the last two giving the same results.

kapton-marvel@MFMC-0000-0029 MacOS % ./wxbuttons

OSXHandleClicked fired — button event reached wx handler

OnOpenImage() entered
wxFileDialog constructed, calling ShowModal()
ShowModal() returned: 5101 (wxID_OK=5100, wxID_CANCEL=5101)

OnOpenImage(wxCommandEvent) — menu/event path
OnOpenImage() entered
wxFileDialog constructed, calling ShowModal()
ShowModal() returned: 5101 (wxID_OK=5100, wxID_CANCEL=5101)

OnOpenImage(wxCommandEvent) — menu/event path
OnOpenImage() entered
wxFileDialog constructed, calling ShowModal()
ShowModal() returned: 5101 (wxID_OK=5100, wxID_CANCEL=5101)


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4407807964@github.com>

VZ

unread,
May 8, 2026, 12:00:23 PMMay 8
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26407)

Wait, I've just realized that you're running this from the terminal. I think the file dialog can't be opened in this case, it only works for bundled applications. Please create a proper application bundle and test it there, I think it should work.


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4407847347@github.com>

Kyle Kenney

unread,
May 8, 2026, 12:28:42 PMMay 8
to wx-...@googlegroups.com, Subscribed
kapton-marvel left a comment (wxWidgets/wxWidgets#26407)

Infact I've been using this as a bundle always, I just couldn't get output or error messages, I modified the code a bit and added logging so I can read it from terminal instead,

in Cmake I use to make the bundle.

# Add the executable
if (WIN32)
    add_executable(wxbutton WIN32 ${SOURCES} ${HEADERS})
elseif (APPLE)
    add_executable(wxbutton MACOSX_BUNDLE ${SOURCES})
endif ()
#include <wx/wx.h>
#include <wx/image.h>
#include <cstdio>

static FILE* gLog = nullptr;
static void dbg(const char* msg) {
    if (gLog) { fprintf(gLog, "%s\n", msg); fflush(gLog); }
    fprintf(stderr, "%s\n", msg);
}

class ImagePanel : public wxPanel {
public:
    ImagePanel(wxWindow* parent) : wxPanel(parent) {
        Bind(wxEVT_PAINT, &ImagePanel::OnPaint, this);
    }

    void LoadImage(const wxString& path) {
        wxImage img;
        if (img.LoadFile(path)) {
            m_bitmap = wxBitmap(img);
            Refresh();
        }
    }

private:
    void OnPaint(wxPaintEvent&) {
        wxPaintDC dc(this);
        if (m_bitmap.IsOk())
            dc.DrawBitmap(m_bitmap, 0, 0, false);
    }

    wxBitmap m_bitmap;
};

class MainFrame : public wxFrame {
public:
    MainFrame() : wxFrame(nullptr, wxID_ANY, "Image Viewer", wxDefaultPosition, wxSize(800, 600)) {
        auto* fileMenu = new wxMenu;
        fileMenu->Append(wxID_OPEN, "&Open Image...\tCmd+O");
        auto* menuBar = new wxMenuBar;
        menuBar->Append(fileMenu, "&File");
        SetMenuBar(menuBar);
        Bind(wxEVT_MENU, &MainFrame::OnOpenImage, this, wxID_OPEN);

        auto* sizer = new wxBoxSizer(wxVERTICAL);
        auto* btn = new wxButton(this, wxID_ANY, "Open Image");
        btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
            dbg("OSXHandleClicked fired — button event reached wx handler");
            OnOpenImage();
        });

        m_panel = new ImagePanel(this);
        sizer->Add(btn, 0, wxALL, 8);
        sizer->Add(m_panel, 1, wxEXPAND);
        SetSizer(sizer);
    }

private:
    void OnOpenImage(wxCommandEvent&) {
        dbg("OnOpenImage(wxCommandEvent) — menu/event path");
        OnOpenImage();
    }

    void OnOpenImage() {
        dbg("OnOpenImage() entered");
        wxFileDialog dlg(this, "Open Image", wxEmptyString, wxEmptyString,
            "Image files (*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff)"
            "|*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tiff",
            wxFD_OPEN | wxFD_FILE_MUST_EXIST);
        dbg("wxFileDialog constructed, calling ShowModal()");
        int result = dlg.ShowModal();
        char buf[128];
        snprintf(buf, sizeof(buf), "ShowModal() returned: %d (wxID_OK=%d, wxID_CANCEL=%d)", result, wxID_OK, wxID_CANCEL);
        dbg(buf);
        if (result == wxID_OK)
            m_panel->LoadImage(dlg.GetPath());
    }

    ImagePanel* m_panel;
};

class App : public wxApp {
public:
    bool OnInit() override {
        gLog = fopen("/tmp/wxbutton.log", "w");
        dbg("OnInit — app started");
        wxInitAllImageHandlers();
        (new MainFrame())->Show();
        return true;
    }
};

wxIMPLEMENT_APP(App);

The results I get now are the same:

tail -f /tmp/wxbutton.log
wxFileDialog constructed, calling ShowModal()
ShowModal() returned: 5101 (wxID_OK=5100, wxID_CANCEL=5101)
OnOpenImage(wxCommandEvent) — menu/event path
OnOpenImage() entered
wxFileDialog constructed, calling ShowModal()
ShowModal() returned: 5101 (wxID_OK=5100, wxID_CANCEL=5101)
OnOpenImage(wxCommandEvent) — menu/event path
OnOpenImage() entered
wxFileDialog constructed, calling ShowModal()
ShowModal() returned: 5101 (wxID_OK=5100, wxID_CANCEL=5101)


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4408026938@github.com>

VZ

unread,
May 8, 2026, 12:36:23 PMMay 8
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26407)

In fact, you can run bundled applications from the terminal, they just need to be bundled correctly. I.e. running ./my.app/Contents/MacOS/myapp works the same as running it by clicking on the icon in Finder (AFAIK).

I still think the problem must be with your bundle, please check your Info.plist and compare it with that of the dialogs sample, for example. In fact, I'm almost sure the dialogs do show up correctly in that sample, if you build it, even though the code is basically the same.


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4408073949@github.com>

Kyle Kenney

unread,
May 12, 2026, 6:54:46 AMMay 12
to wx-...@googlegroups.com, Subscribed
kapton-marvel left a comment (wxWidgets/wxWidgets#26407)

I created a new Info.plist, recompiled everything and now everything works. It seems there was something wrong with it. But now finally everything works, thanks a lot for your help

Here is the following plist I used, maybe it'll help someone in the future.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">
<dict>

    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>

    <key>CFBundleExecutable</key>
    <string>wxbutton</string>

    <key>CFBundleIdentifier</key>
    <string>com.yourcompany.wxbutton</string>

    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>

    <key>CFBundleName</key>
    <string>wxbutton</string>

    <key>CFBundlePackageType</key>
    <string>APPL</string>

    <key>CFBundleShortVersionString</key>
    <string>0.5</string>

    <key>CFBundleVersion</key>
    <string>0.5</string>

    <key>NSPrincipalClass</key>
    <string>wxNSApplication</string>

    <key>LSMinimumSystemVersion</key>
    <string>12.0</string>

    <key>NSHighResolutionCapable</key>
    <true/>

</dict>
</plist>

Thanks for your help!


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4429779952@github.com>

VZ

unread,
May 12, 2026, 9:08:50 AMMay 12
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26407)

Glad to see this was resolved.


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26407/4430787099@github.com>

VZ

unread,
May 12, 2026, 9:08:51 AMMay 12
to wx-...@googlegroups.com, Subscribed

Closed #26407 as not planned.


Reply to this email directly, view it on GitHub, or unsubscribe.

Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/26407/issue_event/25431324337@github.com>

Reply all
Reply to author
Forward
0 new messages