From aef35d0ef526c24dc4e7ff765e5f93304dc02df6 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 30 Sep 2003 12:49:56 +0000 Subject: [PATCH] use wxEvent::ShouldPropagate() instead of its own propgation control mechanism in wxNavigationKeyEvent (patch 814644) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24010 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/event.h | 17 +++++------------ src/common/containr.cpp | 3 +++ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/wx/event.h b/include/wx/event.h index 884475de28..3befe6f613 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -1731,9 +1731,11 @@ class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent public: wxNavigationKeyEvent() : wxEvent(0, wxEVT_NAVIGATION_KEY), - m_flags(IsForward | Propagate), // defaults are for TAB + m_flags(IsForward), // defaults are for TAB m_focus((wxWindow *)NULL) - { } + { + m_propagationLevel = wxEVENT_PROPAGATE_NONE; + } wxNavigationKeyEvent(const wxNavigationKeyEvent& event) : wxEvent(event), @@ -1754,14 +1756,6 @@ public: void SetWindowChange(bool bIs) { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; } - // some navigation events are meant to be propagated upwards (Windows - // convention is to do this for TAB events) while others should always - // cycle inside the panel/radiobox/whatever we're current inside - bool ShouldPropagate() const - { return (m_flags & Propagate) != 0; } - void SetPropagate(bool bDoIt) - { if ( bDoIt ) m_flags |= Propagate; else m_flags &= ~Propagate; } - // the child which has the focus currently (may be NULL - use // wxWindow::FindFocus then) wxWindow* GetCurrentFocus() const { return m_focus; } @@ -1773,8 +1767,7 @@ private: enum { IsForward = 0x0001, - WinChange = 0x0002, - Propagate = 0x0004 + WinChange = 0x0002 }; long m_flags; diff --git a/src/common/containr.cpp b/src/common/containr.cpp index dfb7a123d8..368cee065d 100644 --- a/src/common/containr.cpp +++ b/src/common/containr.cpp @@ -293,6 +293,9 @@ void wxControlContainer::HandleOnNavigationKey( wxNavigationKeyEvent& event ) // and instead give it to the first/last child depending from which // direction we're coming event.SetEventObject(m_winParent); + // disable propagation for this call as otherwise the event might + // bounce back to us. + wxPropagationDisabler disableProp(event); if ( !child->GetEventHandler()->ProcessEvent(event) ) { // set it first in case SetFocusFromKbd() results in focus -- 2.45.2