Don't override SetFocus() to set the focus to the main window, this isn't
enough as we can be given the focus by the underlying toolkit itself, without
our SetFocus() being called -- this happened in wxGTK when focus was changed
from the keyboard using TAB and in this case it didn't get to the main window
but remaining on the wxListCtrl itself meaning that keyboard input wasn't
processed at all.
Use wxNavigationEnabled<> now to ensure that OnSetFocus() and related methods
do the right thing instead now.
Also get rid of OnSetFocus() in wxListHeaderWindow, it's better to override
AcceptsFocus() to return false to avoid getting focus in the first place.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71039
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#ifndef _WX_GENERIC_LISTCTRL_H_
#define _WX_GENERIC_LISTCTRL_H_
#ifndef _WX_GENERIC_LISTCTRL_H_
#define _WX_GENERIC_LISTCTRL_H_
+#include "wx/containr.h"
#include "wx/scrolwin.h"
#include "wx/textctrl.h"
#include "wx/scrolwin.h"
#include "wx/textctrl.h"
// wxListCtrl
//-----------------------------------------------------------------------------
// wxListCtrl
//-----------------------------------------------------------------------------
-class WXDLLIMPEXP_CORE wxGenericListCtrl: public wxListCtrlBase,
+class WXDLLIMPEXP_CORE wxGenericListCtrl: public wxNavigationEnabled<wxListCtrlBase>,
public wxScrollHelper
{
public:
public wxScrollHelper
{
public:
#endif
virtual bool ShouldInheritColours() const { return false; }
#endif
virtual bool ShouldInheritColours() const { return false; }
- virtual void SetFocus();
// implementation
// --------------
// implementation
// --------------
virtual ~wxListHeaderWindow();
virtual ~wxListHeaderWindow();
+ // We never need focus as we don't have any keyboard interface.
+ virtual bool AcceptsFocus() const { return false; }
+
void DrawCurrent();
void AdjustDC( wxDC& dc );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
void DrawCurrent();
void AdjustDC( wxDC& dc );
void OnPaint( wxPaintEvent &event );
void OnMouse( wxMouseEvent &event );
- void OnSetFocus( wxFocusEvent &event );
// needs refresh
bool m_dirty;
// needs refresh
bool m_dirty;
BEGIN_EVENT_TABLE(wxListHeaderWindow,wxWindow)
EVT_PAINT (wxListHeaderWindow::OnPaint)
EVT_MOUSE_EVENTS (wxListHeaderWindow::OnMouse)
BEGIN_EVENT_TABLE(wxListHeaderWindow,wxWindow)
EVT_PAINT (wxListHeaderWindow::OnPaint)
EVT_MOUSE_EVENTS (wxListHeaderWindow::OnMouse)
- EVT_SET_FOCUS (wxListHeaderWindow::OnSetFocus)
END_EVENT_TABLE()
void wxListHeaderWindow::Init()
END_EVENT_TABLE()
void wxListHeaderWindow::Init()
-void wxListHeaderWindow::OnSetFocus( wxFocusEvent &WXUNUSED(event) )
-{
- m_owner->SetFocus();
- m_owner->Update();
-}
-
bool wxListHeaderWindow::SendListEvent(wxEventType type, const wxPoint& pos)
{
wxWindow *parent = GetParent();
bool wxListHeaderWindow::SendListEvent(wxEventType type, const wxPoint& pos)
{
wxWindow *parent = GetParent();
wxListCtrlBase::DoScreenToClient(x, y);
}
wxListCtrlBase::DoScreenToClient(x, y);
}
-void wxGenericListCtrl::SetFocus()
-{
- // The test in window.cpp fails as we are a composite
- // window, so it checks against "this", but not m_mainWin.
- if ( DoFindFocus() != this )
- m_mainWin->SetFocus();
-}
-
wxSize wxGenericListCtrl::DoGetBestClientSize() const
{
// Something is better than nothing even if this is completely arbitrary.
wxSize wxGenericListCtrl::DoGetBestClientSize() const
{
// Something is better than nothing even if this is completely arbitrary.