wxByte GetPopupWindowState() const { return m_popupWinState; }
+ // Set value returned by GetMainWindowOfCompositeControl
+ void SetCtrlMainWnd( wxWindow* wnd ) { m_mainCtrlWnd = wnd; }
+
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;
// 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).
void OnText(wxCommandEvent &event);
void OnSize(wxSizeEvent& event);
+ void OnFocus(wxFocusEvent& event);
wxCalendarCtrl *m_cal;
wxComboCtrl* m_combo;
m_toplevEvtHandler = (wxEvtHandler*) NULL;
#endif
+ m_mainCtrlWnd = this;
+
m_heightPopup = -1;
m_widthMinPopup = -1;
m_anchorSide = 0;
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;
}
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
m_combo = new wxComboCtrl(this, -1, wxEmptyString,
wxDefaultPosition, wxDefaultSize);
+ m_combo->SetCtrlMainWnd(this);
+
m_popup = new wxCalendarComboPopup();
#if defined(__WXMSW__)
}
+void wxDatePickerCtrlGeneric::OnFocus(wxFocusEvent& WXUNUSED(event))
+{
+ m_combo->SetFocus();
+}
+
+
#endif // wxUSE_DATEPICKCTRL_GENERIC
#endif // wxUSE_DATEPICKCTRL