wxAuiNotebook page buttons stay pressed when mouse leaves (Issue #26803)

9 views
Skip to first unread message

BazaarAcc32

unread,
Aug 8, 2026, 10:02:32 AM (2 days ago) Aug 8
to wx-...@googlegroups.com, Subscribed
BazaarAcc32 created an issue (wxWidgets/wxWidgets#26803)

Description

When buttons are added to wxAuiNotebook, whether custom or wxAUI_NB_CLOSE_BUTTON, the button's bitmap is offset by 1 pixel when clicked. This is done in the IndentPressedBitmap function here:
https://github.com/wxWidgets/wxWidgets/blob/master/src/aui/tabart.cpp#L68

However, if you keep the mouse pressed and the mouse cursor leaves the button, the button will be redrawn without the wxAUI_BUTTON_STATE_HOVER flag, but the wxAUI_BUTTON_STATE_PRESSED flag remains.

This causes the button to appear pressed even though the mouse cursor has already left it.

Expected vs observed behaviour:

If the mouse cursor has left the tab button, then even if the left button is pressed, the button should be drawn without a 1 pixel offset.

We can fix it in IndentPressedBitmap. To do this, we need to check not only wxAUI_BUTTON_STATE_PRESSED, but also wxAUI_BUTTON_STATE_HOVER. If both conditions are met, only then should we give the button a 1-pixel offset.

To Reproduce:

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

class MyFrame : public wxFrame
{
public:
    MyFrame()
        : wxFrame(nullptr, wxID_ANY, "AuiNotebook button", wxDefaultPosition, wxSize(800, 500))
    {
        auto* notebook = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
            wxAUI_NB_DEFAULT_STYLE | wxAUI_NB_CLOSE_BUTTON | wxAUI_NB_WINDOWLIST_BUTTON);

        notebook->AddPage(new wxPanel(notebook), "First page");
        notebook->AddPage(new wxPanel(notebook), "Second page");
    }
};

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: 3.3.3
  • wxWidgets port you use: 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/26803@github.com>

VZ

unread,
Aug 9, 2026, 1:18:55 PM (13 hours ago) Aug 9
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26803)

I'm not sure what is this about. It's normal for the button to remain pressed while it is really pressed, even if you move the mouse outside of it — this is how all buttons behave. It wouldn't be normal if it remained pressed when the mouse is released, but this doesn't seem to happen in my testing.

So do you see the latter and, if so, how exactly can I reproduce it, or do you just see the former, in which case it's not a bug 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/26803/5232750279@github.com>

Reply all
Reply to author
Forward
0 new messages