#13271: wxStaticBox parent, broken Tab order

14 views
Skip to first unread message

wxTrac

unread,
Jun 8, 2011, 1:26:03 AM6/8/11
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13271>

#13271: wxStaticBox parent, broken Tab order
---------------------------------+------------------------------------------
Reporter: rollmark | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: wxMSW | Version: 2.9.1
Keywords: msw wxStaticBox tab | Blockedby:
Patch: 0 | Blocking:
---------------------------------+------------------------------------------
Hi,

I'm using wxWidgets wxWidgets-2.9.1 with Visual C++ 2010 on Windows 7
with DialogBlocks 4.40.
I noticed that the new recommended way is to use the wxStaticBox as
a parent to other controls (this change is also reflectd in the code
generated from DialogBlocks).

However there seems to be a bug with regard to the resulting tab
order. The controls that are grouped as children of the wxStaticBox
are not reachable via TAB key. Instead the next control that is not a
child of the wxStaticBox ist selected.

You can reproduce this behaviour in the controls sample. After line
996 in controls.cpp (where the wxStaticBoxSizer with the label 'Show
Buttons' is created) add these lines:

wxStaticBox* txtParent = csizer->GetStaticBox();
// wxPanel* txtParent = panel;
csizer->Add(new wxTextCtrl( txtParent, wxID_ANY, s, wxPoint(20,160),
wxSize(80,wxDefaultCoord)));
csizer->Add(new wxTextCtrl( txtParent, wxID_ANY, s, wxPoint(20,160),
wxSize(80,wxDefaultCoord)));
csizer->Add(new wxTextCtrl( txtParent, wxID_ANY, s, wxPoint(20,160),
wxSize(80,wxDefaultCoord)));

Place the cursor in the first text control on the wxSizer page. If the
static box is the wxTextCtrl parent, then pressing TAB moves the focus to
the
checkbox with the label '1'. If the panel ist the parent, then
pressing TAB moves the focus to the second text control as expected.

Regards,


--
Ticket URL: <http://trac.wxwidgets.org/ticket/13271>

wxTrac

unread,
Jun 8, 2011, 6:57:39 AM6/8/11
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:1>

#13271: wxStaticBox parent, broken Tab order
---------------------------------+------------------------------------------
Reporter: rollmark | Owner:

Type: defect | Status: confirmed


Priority: normal | Milestone:
Component: wxMSW | Version: 2.9.1
Keywords: msw wxStaticBox tab | Blockedby:
Patch: 0 | Blocking:
---------------------------------+------------------------------------------

Changes (by vadz):

* status: new => confirmed


Comment:

We probably need to use wxControlContainer in wxStaticBox to make this
work.

Alternatively, we could try to finally understand why doesn't Windows
native TAB navigation (as implemented by `::IsDialogMessage()`) work for
wxWidgets programs.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:1>

wxTrac

unread,
Aug 16, 2011, 12:09:35 PM8/16/11
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:2>

#13271: wxStaticBox parent, broken Tab order
---------------------------------+------------------------------------------
Reporter: rollmark | Owner:

Type: defect | Status: confirmed


Priority: normal | Milestone:
Component: wxMSW | Version: 2.9.1
Keywords: msw wxStaticBox tab | Blockedby:
Patch: 0 | Blocking:
---------------------------------+------------------------------------------

Comment(by staticinline):

Is any quick workaround known? I use a lot of wxStaticBoxSizer's, and MSW
tab traversal broke in moving to wxWidgets 2.9.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:2>

wxTrac

unread,
Oct 10, 2012, 10:05:47 AM10/10/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:3>

#13271: wxStaticBox parent, broken Tab order
---------------------------------+------------------------------------------
Reporter: rollmark | Owner:
Type: defect | Status: confirmed
Priority: normal | Milestone:
Component: wxMSW | Version: 2.9.1
Keywords: msw wxStaticBox tab | Blockedby:
Patch: 0 | Blocking:
---------------------------------+------------------------------------------

Comment(by alexandrub):

Hi,

Using the latest trunk the problem is still noticeable (even after
changeset r72523) but can be solved by setting wxTAB_TRAVERSAL on static
box creation. I'm not sure how this flag is to be used generally but maybe
this should be default on static boxes now? The same thing happens with
wxChoiceBook (demonstrated with the patch above by removing and reapplying
changes to xh_sizer.cpp and xh_choicbk.cpp).


--
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:3>

wxTrac

unread,
Oct 11, 2012, 7:55:57 PM10/11/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:4>

#13271: wxStaticBox parent, broken Tab order
---------------------------------+------------------------------------------
Reporter: rollmark | Owner: vadz
Type: defect | Status: accepted
Priority: normal | Milestone: 2.9.5
Component: wxMSW | Version: 2.9.1
Keywords: msw wxStaticBox tab | Blockedby:
Patch: 0 | Blocking:
---------------------------------+------------------------------------------
Changes (by vadz):

* owner: => vadz
* status: confirmed => accepted
* milestone: => 2.9.5


Comment:

We do indeed need `wxTAB_TRAVERSAL` for `wxStaticBox` but it's not the
only problem here, we also need to ensure that it doesn't get the focus
itself which is possible since r72523. I'm going to look at this, thanks.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:4>

wxTrac

unread,
Oct 13, 2012, 6:51:52 PM10/13/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:5>

#13271: wxStaticBox parent, broken Tab order
---------------------------------+------------------------------------------
Reporter: rollmark | Owner: vadz
Type: defect | Status: accepted
Priority: normal | Milestone: 2.9.5
Component: wxMSW | Version: 2.9.1
Keywords: msw wxStaticBox tab | Blockedby:
Patch: 0 | Blocking:
---------------------------------+------------------------------------------

Comment(by VZ):

(In [72663]) Allow using windows that can't be focused with
wxNavigationEnabled<>.

The code in wxNavigationEnabled<> assumed that the window itself could be
focused if it didn't have any focusable children because it was originally
extracted from wxPanel that can, indeed, be focused. This is however not
the
case for all windows, notably not for wxStaticBox which now derives from
wxNavigationEnabled as well but can never be focused itself.

Add wxControlContainer::DisableSelfFocus() and call it from wxStaticBox to
support this situation. This required splitting m_acceptsFocus flag into
m_acceptsFocusSelf and m_acceptsFocusChildren and updating various methods
using them.

See #13271.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:5>

wxTrac

unread,
Oct 13, 2012, 6:52:15 PM10/13/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:6>

#13271: wxStaticBox parent, broken Tab order
-----------------------+----------------------------------------------------
Reporter: rollmark | Owner: vadz
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: wxMSW | Version: 2.9.1
Resolution: fixed | Keywords: msw wxStaticBox tab
Blockedby: | Patch: 0
Blocking: |
-----------------------+----------------------------------------------------
Changes (by VZ):

* status: accepted => closed
* resolution: => fixed


Comment:

(In [72664]) Set wxTAB_TRAVERSAL for wxNavigationEnabled<> windows with
focusable children.

We need to have this flag under wxMSW in order for navigation events to be
generated for the window. As wxNavigationEnabled can't set this flag on
creation because its ctor is called too early, do it in overridden
AddChild().

Closes #13271.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/13271#comment:6>
Reply all
Reply to author
Forward
0 new messages