[ 1585858 ] Fix wxDatePickerCtrlGeneric and wxComboCtrl kb navigation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42539 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -394,6 +394,9 @@ public:
|
||||
|
||||
wxByte GetPopupWindowState() const { return m_popupWinState; }
|
||||
|
||||
// Set value returned by GetMainWindowOfCompositeControl
|
||||
void SetCtrlMainWnd( wxWindow* wnd ) { m_mainCtrlWnd = wnd; }
|
||||
|
||||
protected:
|
||||
|
||||
//
|
||||
@@ -492,6 +495,9 @@ protected:
|
||||
virtual void DoSetToolTip( wxToolTip *tip );
|
||||
#endif
|
||||
|
||||
virtual wxWindow *GetMainWindowOfCompositeControl()
|
||||
{ return m_mainCtrlWnd; }
|
||||
|
||||
// This is used when m_text is hidden (readonly).
|
||||
wxString m_valueString;
|
||||
|
||||
@@ -520,6 +526,9 @@ protected:
|
||||
// this is for the popup window
|
||||
wxEvtHandler* m_popupWinEvtHandler;
|
||||
|
||||
// main (ie. topmost) window of a composite control (default = this)
|
||||
wxWindow* m_mainCtrlWnd;
|
||||
|
||||
// used to prevent immediate re-popupping incase closed popup
|
||||
// by clicking on the combo control (needed because of inconsistent
|
||||
// transient implementation across platforms).
|
||||
|
@@ -76,6 +76,7 @@ private:
|
||||
|
||||
void OnText(wxCommandEvent &event);
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnFocus(wxFocusEvent& event);
|
||||
|
||||
wxCalendarCtrl *m_cal;
|
||||
wxComboCtrl* m_combo;
|
||||
|
@@ -732,6 +732,8 @@ void wxComboCtrlBase::Init()
|
||||
m_toplevEvtHandler = (wxEvtHandler*) NULL;
|
||||
#endif
|
||||
|
||||
m_mainCtrlWnd = this;
|
||||
|
||||
m_heightPopup = -1;
|
||||
m_widthMinPopup = -1;
|
||||
m_anchorSide = 0;
|
||||
@@ -1537,11 +1539,15 @@ void wxComboCtrlBase::OnKeyEvent(wxKeyEvent& event)
|
||||
if ( keycode == WXK_TAB )
|
||||
{
|
||||
wxNavigationKeyEvent evt;
|
||||
|
||||
wxWindow* mainCtrl = GetMainWindowOfCompositeControl();
|
||||
|
||||
evt.SetFlags(wxNavigationKeyEvent::FromTab|
|
||||
(!event.ShiftDown() ? wxNavigationKeyEvent::IsForward
|
||||
: wxNavigationKeyEvent::IsBackward));
|
||||
evt.SetEventObject(this);
|
||||
GetParent()->GetEventHandler()->AddPendingEvent(evt);
|
||||
evt.SetEventObject(mainCtrl);
|
||||
evt.SetCurrentFocus(mainCtrl);
|
||||
mainCtrl->GetParent()->GetEventHandler()->AddPendingEvent(evt);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -370,6 +370,7 @@ END_EVENT_TABLE()
|
||||
BEGIN_EVENT_TABLE(wxDatePickerCtrlGeneric, wxDatePickerCtrlBase)
|
||||
EVT_TEXT(wxID_ANY, wxDatePickerCtrlGeneric::OnText)
|
||||
EVT_SIZE(wxDatePickerCtrlGeneric::OnSize)
|
||||
EVT_SET_FOCUS(wxDatePickerCtrlGeneric::OnFocus)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
#ifndef wxHAS_NATIVE_DATEPICKCTRL
|
||||
@@ -404,6 +405,8 @@ bool wxDatePickerCtrlGeneric::Create(wxWindow *parent,
|
||||
m_combo = new wxComboCtrl(this, -1, wxEmptyString,
|
||||
wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
m_combo->SetCtrlMainWnd(this);
|
||||
|
||||
m_popup = new wxCalendarComboPopup();
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
@@ -524,6 +527,12 @@ void wxDatePickerCtrlGeneric::OnText(wxCommandEvent &ev)
|
||||
}
|
||||
|
||||
|
||||
void wxDatePickerCtrlGeneric::OnFocus(wxFocusEvent& WXUNUSED(event))
|
||||
{
|
||||
m_combo->SetFocus();
|
||||
}
|
||||
|
||||
|
||||
#endif // wxUSE_DATEPICKCTRL_GENERIC
|
||||
|
||||
#endif // wxUSE_DATEPICKCTRL
|
||||
|
Reference in New Issue
Block a user