Opened 7 years ago

Last modified 9 days ago

#11630 confirmed defect

unable to tab out of a GenericDatePickerCtrl

Reported by: mrooney1 Owned by:
Priority: normal Milestone:
Component: wxGTK Version: stable-latest
Keywords: wxComboCtrl Cc:
Blocked By: Blocking:
Patch: no


Reported after requested to do so in

I'm noticing that on Ubuntu 9.10 with wxPython I can tab into a DatePickerCtrl (Generic as is the case on GTK), but not tab out of, either forward or backward. I've pasted a minimal sample to demonstrate this at (and attached it); you'll notice you can tab into it from the second control and shift+tab back from the fourth, but there is no way to get out of it it appears!

Apparently on OSX tabs work as expected, so perhaps it is a bug in a GenericDatePickerCtrl?

Anyway, if this is a bug that needs to be fixed in wxPython but there is a workaround, I'd LOVE to hear it, however dirty it may be, as this bug in my app is milestoned to be fixed for the impending release.

Attachments (1) download (638 bytes) - added by mrooney1 7 years ago.
sample demonstrating the issue

Download all attachments as: .zip

Change History (18)

Changed 7 years ago by mrooney1

sample demonstrating the issue

comment:1 Changed 7 years ago by jmsalli

  • Status changed from new to confirmed

I can reproduce the issue with the standard calendar sample. Thanks for reporting it.

comment:2 Changed 7 years ago by JMS

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

(In [63158]) When checking whether the parent control has wxTAB_TRAVERSAL, take into account that the wxComboCtrl can be part of a composite control, such as generic wxDatePickerCtrl (fixes #11630).

comment:3 Changed 7 years ago by jmsalli

As a workaround, you could try using wx.TAB_TRAVERSAL style for the date picker control.

comment:4 Changed 7 years ago by mrooney1

Thanks for the lightning fast fix and the workaround, it works perfectly!

comment:5 Changed 7 years ago by jmsalli

  • Keywords wxComboCtrl added
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 2.8.10 to 2.9-svn

Reopened to remind that this bug still exists in wx2.9. Navigation code was changed, and the new wxGTK wxWindow::DoNavigateIn() doesn't seem to allow navigating out of composite controls (wxSearchCtrl seems to suffer from the same), even if focus is moved to the topmost part of the composite window prior to DoNavigateIn() call. Dispatching wxNavigationKeyEvent manually (as is done in wx2.8) does not work anymore either.

comment:6 Changed 7 years ago by jmsalli

  • Status changed from reopened to confirmed

comment:7 Changed 6 years ago by fsenore

I have found this problem too. I have checked and it still happens in the latest svn trunk.

I have also discovered a similar problem in Windows using the generic date picker control: TAB works until I open the combo. After opening the combo it is not possible to tab out of the control any more.

I read in wxBlog that a new class (wxNavigationEnabled) has been added to fix a similar problem (at least it looks similar).
Are there chances that that class could fix this problem too?

comment:8 Changed 4 years ago by maximand

I'm noticing that on Ubuntu 12.04 with wxWidgets-2.9.4 (or trunk) I can tab into a wxDatePickerCtrl, but not tab out of.
If Ctrl+TAB pressed i've got message:
../src/gtk/window.cpp(3512): assert "Assert failure" failed in DoNavigateIn(): not implemented

comment:9 Changed 4 years ago by vadz

Strangely enough I don't see this assert when pressing Ctrl+TAB in the date picker dialog of the calendar sample.

But the original bug still stands, it's true that something is wrong with our TAB navigation implementation for composite controls...

comment:10 follow-up: Changed 9 months ago by will133

Unfortunately, I still see this issue on wxPython I also can't seem to find a way to work around this as well. Please let me know if there's something that can be done.

comment:11 in reply to: ↑ 10 Changed 10 days ago by zylyco

Hi all,

1 ) ---------------------------------
My software with wxPython/DatePickerCtrl runs as expected on Windows :
inside the widget, I press " Tab " key, on the "focus" jumps to the next widget.

But on each Linux system I tried (Ubuntu, openSuse, Fedora, Mint, MageIA, CentOS, Debian), in case I used the packages provides for wxPython, but as well if I've installed it from sources :
when the " focus " is inside the DatePickerCtrl, the " Tab " Key used to "jump" to the next Widget is not working... I'm blocked inside the DatePickerCtrl, and the only way to move from here, is to use the mouse to select the next widget...

I don't have tried on OSx, because I don't use it, so I don't know for this system.

On each of my Linux systems, I have :
Python 2.7.x
wxGTK 3.0.2

I repeat, on Windows7/8/10, I don't have any kind of problem with this Widget, it works fine.

But I've noticed this behaviour on all the Linux systems I'm using...

I tried to use the DatePickerCtrl widget with a C++ code, using wxWidgets 3.0.2 :
the Tab key on this widget doesn't jump the focus either...

This seems a wxWidgets issue.

It's a pitty for me, because users prefer "Tab" key to navigate quickly.

My GTK version (not tested on GTK3) :
[regis@localhost cpp]$ wx-config --list

Default config is gtk2-unicode-3.0

Default config will be used for output

What do you think about this ?
Can't you reproduce the problem on Linux with a wxWidget c++ code ?

Thank you.

comment:12 Changed 10 days ago by vadz

FWIW TAB works fine for me on the date picker page of the widgets sample under Debian with wxGTK.

comment:13 Changed 10 days ago by zylyco

On my debian 8-7-1 : it doesn't work, using the tab key only, the focus (or the cursor if you prefer), you can't get out the datepickerctrl.

Please can you try to compile and run this example :

main.cpp :

// -*- C++ -*-
// generated by wxGlade 0.7.1 on Fri Jun 16 07:20:12 2017
// Example for compiling a single file project under Linux using g++:
//  g++ MyApp.cpp $(wx-config --libs) $(wx-config --cxxflags) -o MyApp
// Example for compiling a multi file project under Linux using g++:
//  g++ main.cpp $(wx-config --libs) $(wx-config --cxxflags) -o MyApp Dialog1.cpp Frame1.cpp

#include "main.h"

// begin wxGlade: ::extracode
// end wxGlade

MyFrame::MyFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
    wxFrame(parent, id, title, pos, size, wxTAB_TRAVERSAL)
    // begin wxGlade: MyFrame::MyFrame
    label_1 = new wxStaticText(this, wxID_ANY, _("Enter value :"));
    text_ctrl_1 = new wxTextCtrl(this, wxID_ANY, wxEmptyString);
    label_2 = new wxStaticText(this, wxID_ANY, _("Select date : "));
    datepicker_ctrl_1 = new wxDatePickerCtrl(this, wxID_ANY, wxDefaultDateTime,wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT);
    button_1 = new wxButton(this, wxID_ANY, _("Close"));

    // end wxGlade

void MyFrame::set_properties()
    // begin wxGlade: MyFrame::set_properties
    // end wxGlade

void MyFrame::do_layout()
    // begin wxGlade: MyFrame::do_layout
    wxBoxSizer* sizer_2 = new wxBoxSizer(wxVERTICAL);
    sizer_2->Add(20, 20, 0, 0, 0);
    sizer_2->Add(label_1, 0, 0, 0);
    sizer_2->Add(text_ctrl_1, 0, wxALIGN_CENTER, 0);
    sizer_2->Add(20, 20, 0, 0, 0);
    sizer_2->Add(label_2, 0, 0, 0);
    sizer_2->Add(datepicker_ctrl_1, 0, wxALIGN_CENTER, 0);
    sizer_2->Add(20, 20, 0, 0, 0);
    sizer_2->Add(button_1, 0, wxALIGN_CENTER, 0);
    sizer_2->Add(20, 20, 0, 0, 0);
    // end wxGlade

class MyApp: public wxApp {
    bool OnInit();
    wxLocale m_locale;  // locale we'll be using


bool MyApp::OnInit()

    MyFrame* frame_1 = new MyFrame(NULL, wxID_ANY, wxEmptyString);
    return true;

and main.h :

// -*- C++ -*-
// generated by wxGlade 0.7.1 on Fri Jun 16 07:20:12 2017
// Example for compiling a single file project under Linux using g++:
//  g++ MyApp.cpp $(wx-config --libs) $(wx-config --cxxflags) -o MyApp
// Example for compiling a multi file project under Linux using g++:
//  g++ main.cpp $(wx-config --libs) $(wx-config --cxxflags) -o MyApp Dialog1.cpp Frame1.cpp

#ifndef MAIN_H
#define MAIN_H

#include <wx/wx.h>
#include <wx/image.h>
#include <wx/intl.h>

#define APP_CATALOG "app"  // replace with the appropriate catalog name

// begin wxGlade: ::dependencies
#include <wx/datectrl.h>
// end wxGlade

// begin wxGlade: ::extracode
// end wxGlade

class MyFrame: public wxFrame {
    // begin wxGlade: MyFrame::ids
    // end wxGlade

    MyFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE);

    // begin wxGlade: MyFrame::methods
    void set_properties();
    void do_layout();
    // end wxGlade

    // begin wxGlade: MyFrame::attributes
    wxStaticText* label_1;
    wxTextCtrl* text_ctrl_1;
    wxStaticText* label_2;
    wxDatePickerCtrl* datepicker_ctrl_1;
    wxButton* button_1;
    // end wxGlade
}; // wxGlade: end class

#endif // MAIN_H

then compile with :

g++ main.cpp main.h  `wx-config --cxxflags --libs` -o simple

run the "simple" file,
and try to use the Tab key only, to see if the focus can move from the first input widget, then to the datepickerctrl, and then to the button.

On my Debian system, the focus can't get out the datepickerctrl, using only the Tab key.

May be my c++ code is wrong... so can you tell me what's wrong with it ?

Thank you.

comment:14 Changed 10 days ago by vadz

It would be really much simpler for you to build and run the widgets sample instead.

comment:15 Changed 9 days ago by zylyco


You told me to run widgets sample :

  • I installed from scratch wxWidgets 3-1-0 from source on a Debian8.7.1
  • I launched the sample " Calendar "
  • In this sample, in the menu bar, I clicked on " Date picker " then " Choose date..."
  • A dialog opened, containing a DatePickerCtrl and 2 buttons (OK and Cancel)
  • And when the focus (or the active widget if you prefer) is located on the DatePickerCtrl, you can't jump to any of the buttons by clicking on the Tab key

I'm sorry for insisting, but users prefer the Tab key for changing from widgets to another, it's much more quicker.

Can't you notice this uncomfortable behaviour yourself ?

comment:16 Changed 9 days ago by fsenore

That dialog contains only a single control and two buttons.

IIRIC on Mac you need to enable full keyboard access to be able to tab into a button.
If full keyboard access is disabled the focus has nowhere to move to, so it remains in the control.

comment:17 Changed 9 days ago by zylyco


In the Calendar's sample :
the focus works fine with " Tab " or " Shift Tab " with the 2 buttons (Ok and Cancel)

And on Windows system there's no problem.

On OSx, I don't know, because I don't work on it.

This problem is only on Linux (in fact all 7 ones I mentioned before, and that I use)

Note: See TracTickets for help on using tickets.