Issue is not with only wxCalenderCtrl, we can reproduce this issue by placing wxTextCtrl on wxComboPopup.
wxTextCtrl never gets the focus, I can not type anything.
I have a wxCancelnder control that is added to the wxComboPopup as a child.
I used UseAltPopupWindow() function just before void wxComboCtrl::SetPopupControl(wxComboPopup * popup)
Code: Select all
UseAltPopupWindow();
m_popup = new DatePickerPopup();
SetPopupControl(m_popup);
Code: Select all
class DatePickerPopup : public wxPanel, public wxComboPopup
{
...
m_calendar = new wxCalendarCtrl(this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxNO_BORDER);
...
}
On Windows, UseAltPopupWindow() solves the focus issues, but under mac flag set by the UseAltPopupWindow() is not used.
I checked the combocmn.cpp, I see different code is executed in case of WIndows and Mac
Code: Select all
// Create popup window and the child control
void wxComboCtrlBase::CreatePopup()
{
wxComboPopup* popupInterface = m_popupInterface;
wxWindow* popup;
if ( !m_winPopup )
{
#ifdef wxComboPopupWindowBase2
if ( m_iFlags & wxCC_IFLAG_USE_ALT_POPUP )
{
#if !USES_GENERICTLW
m_winPopup = new wxComboPopupWindowBase2( this, wxNO_BORDER );
#else
int tlwFlags = wxNO_BORDER;
#ifdef wxCC_GENERIC_TLW_IS_FRAME
tlwFlags |= wxFRAME_NO_TASKBAR;
#endif
#ifdef wxCC_GENERIC_TLW_IS_NONOWNEDWINDOW
m_winPopup = new wxComboPopupWindowBase2( this, wxID_ANY,
wxPoint(-21,-21), wxSize(20, 20),
tlwFlags );
#else
m_winPopup = new wxComboPopupWindowBase2( this, wxID_ANY, wxEmptyString,
wxPoint(-21,-21), wxSize(20, 20),
tlwFlags );
#endif
#endif
m_popupWinType = SECONDARY_POPUP_TYPE;
}
else
#endif // wxComboPopupWindowBase2
{
m_winPopup = new wxComboPopupWindow( this, wxNO_BORDER );
m_popupWinType = PRIMARY_POPUP_TYPE;
}
m_popupWinEvtHandler = new wxComboPopupWindowEvtHandler(this);
m_winPopup->PushEventHandler(m_popupWinEvtHandler);
}
popupInterface->Create(m_winPopup);
m_popup = popup = popupInterface->GetControl();
m_popupEvtHandler = new wxComboPopupEvtHandler(this);
popup->PushEventHandler( m_popupEvtHandler );
// This may be helpful on some platforms
// (eg. it bypasses a wxGTK popupwindow bug where
// window is not initially hidden when it should be)
m_winPopup->Hide();
popupInterface->m_iFlags |= wxCP_IFLAG_CREATED;
}
Under Windows
Code: Select all
m_winPopup = new wxComboPopupWindowBase2( this, wxID_ANY, wxEmptyString,
wxPoint(-21,-21), wxSize(20, 20),
tlwFlags );
m_popupWinType = SECONDARY_POPUP_TYPE;
Code: Select all
m_winPopup = new wxComboPopupWindow( this, wxNO_BORDER );
m_popupWinType = PRIMARY_POPUP_TYPE;
Please refer combocmn.cpp for details.
I am not sure what workaround or configuration is required to make it work.