Wrong wxChoice size in wxAuiToolBar after DPI was changed (Issue #26779)

6 views
Skip to first unread message

BazaarAcc32

unread,
7:01 AM (7 hours ago) 7:01 AM
to wx-...@googlegroups.com, Subscribed
BazaarAcc32 created an issue (wxWidgets/wxWidgets#26779)

Bug description:

I open an application containing a wxAuiToolBar with a Scale of 100% (this is the recommended scale for my monitor).

This wxAuiToolBar contains two elements: a wxChoice and a wxTextCtrl. After opening the application, I change the Scale to 175%, and the height of the wxChoice element becomes smaller than the height of the wxTextCtrl element. However, if I restart the application, the height of the wxChoice element becomes the same as the height of the wxTextCtrl element.

See scrennshot:

wrong_wxchoice_height_in_auibar.png (view on web)

Expected vs observed behaviour:

This is a bug in the wxAuiToolBar. The height of the wxChoice element should immediately match the height of the wxTextCtrl element, without having to restart the application.

To Reproduce:

#include <wx/wx.h>
#include <wx/choice.h>
#include <wx/aui/auibar.h>

class MyFrame : public wxFrame
{
public:
    MyFrame()
        : wxFrame(nullptr, wxID_ANY, "wxAuiToolBar Demo", wxDefaultPosition, wxSize(400, 150))
    {
        auto* toolbar = new wxAuiToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE);

        auto* choice = new wxChoice(toolbar, wxID_ANY);
        choice->Append("One");
        choice->Append("Two");
        choice->Append("Three");
        choice->SetSelection(0);

        auto* text = new wxTextCtrl(toolbar, wxID_ANY, "Value", wxDefaultPosition, wxSize(120, -1));

        toolbar->AddControl(choice);
        toolbar->AddSpacer(5);
        toolbar->AddControl(text);

        toolbar->Realize();

        auto* sizer = new wxBoxSizer(wxVERTICAL);
        sizer->Add(toolbar, 0, wxEXPAND);
        SetSizer(sizer);
    }
};

class MyApp : public wxApp
{
public:
    bool OnInit() override
    {
        MSWEnableDarkMode(wxApp::DarkMode_Always);

        auto* frame = new MyFrame();
        frame->Show();

        return true;
    }
};

wxIMPLEMENT_APP(MyApp);

Platform and version information

  • wxWidgets version you use: 3.3.3
  • wxWidgets port wxMSW
  • OS and its version: Windows 11


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/26779@github.com>

VZ

unread,
7:17 AM (6 hours ago) 7:17 AM
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26779)

Hmm, I thought I had fixed this with d5c0625 (Fix appearance of controls in wxAuiToolBar after DPI change, 2026-05-07) but apparently not.

Also, this is almost surely not related to dark mode 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/26779/5178246832@github.com>

BazaarAcc32

unread,
7:19 AM (6 hours ago) 7:19 AM
to wx-...@googlegroups.com, Subscribed
BazaarAcc32 left a comment (wxWidgets/wxWidgets#26779)

@vadz
Yes, this issue occurs in both light and dark mode.


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/26779/5178267023@github.com>

Reply all
Reply to author
Forward
0 new messages