wxAuiToolBar has wrong size after window maximized & scale updated (Issue #26807)

7 views
Skip to first unread message

BazaarAcc32

unread,
Aug 9, 2026, 6:28:17 AM (20 hours ago) Aug 9
to wx-...@googlegroups.com, Subscribed
BazaarAcc32 created an issue (wxWidgets/wxWidgets#26807)

Description

If you create a wxAuiToolBar containing an element with a proportion of 1, then maximize the main frame and then change the Scale from, say, 100% to 175%, you'll see that the elements with a proportion of 1 collapse.

In my example below, this can be seen in the wxAuiToolBar::AddStretchSpacer and wxTextCtrl elements.

Expected vs observed behaviour:

wxAuiToolBar elements should not collapse, but should take up the full available width.

To Reproduce:

  1. Compile the code below
  2. Maximize the width of the main window by clicking on the rectangle in the upper right corner
  3. Change the Scale value from 100% to 175%
    Note: After wxAuiToolBar collapsed, if we restore the previous size, the display will be corrected

Here is code for test

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

class MyFrame : public wxFrame
{
public:
    MyFrame()
        : wxFrame(
            nullptr,
            wxID_ANY,
            "wxAuiToolBar example",
            wxDefaultPosition,
            wxSize(700, 200))
    {
        auto* mainSizer = new wxBoxSizer(wxVERTICAL);

        auto* toolbar1 = new wxAuiToolBar(
            this,
            wxID_ANY,
            wxDefaultPosition,
            wxDefaultSize,
            wxAUI_TB_HORIZONTAL | wxAUI_TB_PLAIN_BACKGROUND);

        auto* label1 = new wxStaticText(toolbar1, wxID_ANY, "Name:");
        auto* textCtrl = new wxTextCtrl(toolbar1, wxID_ANY);

        toolbar1->AddControl(label1);
        auto* textItem = toolbar1->AddControl(textCtrl);
        textItem->SetProportion(1);

        toolbar1->Realize();

        auto* toolbar2 = new wxAuiToolBar(
            this,
            wxID_ANY,
            wxDefaultPosition,
            wxDefaultSize,
            wxAUI_TB_HORIZONTAL);

        auto* label2 = new wxStaticText(toolbar2, wxID_ANY, "Left");
        auto* label3 = new wxStaticText(toolbar2, wxID_ANY, "Right");

        toolbar2->AddControl(label2);
        toolbar2->AddStretchSpacer(1);
        toolbar2->AddControl(label3);

        toolbar2->Realize();

        mainSizer->Add(toolbar1, 0, wxEXPAND);
        mainSizer->Add(toolbar2, 0, wxEXPAND);

        SetSizer(mainSizer);
        Layout();
    }
};

class MyApp : public wxApp
{
public:
    bool OnInit() override
    {
        auto* frame = new MyFrame();
        frame->Show();
        return true;
    }
};

wxIMPLEMENT_APP(MyApp);

Platform and version information

  • wxWidgets version you use:
  • wxWidgets port you use:
  • OS and its version:
    • GTK version:
    • Which GDK backend is used:
    • Desktop environment :
    • Current theme:


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

Reply all
Reply to author
Forward
0 new messages