#15376 closed defect (fixed)

Tabbing through wxStaticBox is broken on Gtk when items are children, not siblings (deprecated)

Reported by: alexandrub Owned by:
Priority: high Milestone: 3.0.0
Component: wxGTK Version: stable-latest
Keywords: wxStaticBox, tab, traversal, wxgtk, gtk Cc:
Blocked By: Blocking:
Patch: no

Description

After 2.9.1 the recommended way to add items to a static box is as children, not as siblings. This breaks TAB traversal within wxStaticBox on Gtk.

This can be reproduced by modifying the Dialogs sample with:

@@ -2953,7 +2954,7 @@
     wxStaticBox* staticBox1 = new wxStaticBox(panel, wxID_ANY, _("Tile font size:"));
     wxBoxSizer* itemSizer5 = new wxStaticBoxSizer( staticBox1, wxHORIZONTAL );
 
-    wxSpinCtrl* spinCtrl = new wxSpinCtrl(panel, ID_FONT_SIZE, wxEmptyString, wxDefaultPosition,
+    wxSpinCtrl* spinCtrl = new wxSpinCtrl(staticBox1, ID_FONT_SIZE, wxEmptyString, wxDefaultPosition,
         wxSize(80, wxDefaultCoord));
     itemSizer5->Add(spinCtrl, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
 

The solution came to me rather heuristically, because debugging was difficult (the fact that TAB traversal is handled at Gtk level didn't help):

--- src/gtk/statbox.cpp	(revision 74614)
+++ src/gtk/statbox.cpp	(working copy)
@@ -122,7 +122,7 @@
         gtk_container_add( GTK_CONTAINER (m_widget), m_wxwindow );
     }
 
-    wxWindow::AddChild( child );
+    wxNavigationEnabled::AddChild( child );
 }
 
 void wxStaticBox::SetLabel( const wxString& label )

I think the samples should be updated to follow the new rule, so that such errors are discovered easier.

Change History (1)

comment:1 Changed 17 months ago by PC

  • Resolution set to fixed
  • Status changed from new to closed

(In [74615]) fix tab traversal of wxStaticBox children, closes #15376

Note: See TracTickets for help on using tickets.