From 082d1fd28a79d728a26a384e07fcefa9c6808ae8 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Sat, 24 May 2025 22:14:01 +0200 Subject: [PATCH] Fix TAB behaviour in a panel with notebook as only active child If a panel contained a notebook and some other element(s) that didn't accept focus (e.g. because they were disabled), TAB didn't wrap around correctly. Fix this by ensuring the focus gets to the notebook itself in this case by handling it in wxNotebook itself if the parent didn't do anything. See #25443. (cherry picked from commit a2ed8ac9e6239740902ca2d5062079b2b5673e50) --- docs/changes.txt | 1 + src/msw/notebook.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 481e70a57c..824dda5a7f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -274,6 +274,7 @@ wxMSW - Fix regression in wxTreeCtrl indent size in high DPI (Maarten Bent, #25282). - Fix using wxNO_IMPLICIT_WXSTRING_ENCODING with PCH (#25568). - Fix crash when copying wxBitmaps if GDI resources are exhausted (#24703). +- Fix TAB behaviour in a panel with notebook as only active child (#25443). wxOSX: diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 6eb6f4726b..977249068f 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -1070,8 +1070,14 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) else if ( parent ) { event.SetCurrentFocus(this); - parent->HandleWindowEvent(event); - } + if ( !parent->HandleWindowEvent(event) ) + { + // if the parent didn't handle this event, the notebook + // must be its only child accepting focus, so take it + event.Skip(false); + SetFocus(); + } + } } } }