[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : luke
Repository : xara
Revision   : 1423
Date       : Fri Jul  7 15:31:17 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/camelot.cpp

Slightly more generix fix for BZ#1254


Diff:
Index: Trunk/XaraLX/wxOil/camelot.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camelot.cpp	(revision 1422)
+++ Trunk/XaraLX/wxOil/camelot.cpp	(revision 1423)
@@ -293,29 +293,40 @@
 			((wxWindow*)pEventObject)->GetClassInfo()->GetClassName(),
 			event.GetEventType() == wxEVT_KEY_DOWN ? _T("KD") : _T("KU") );
 		
-		// Is the object allowed to recieve keys? 
-		wxClassInfo* pClassInfo = pEventObject->GetClassInfo();
-		if( pClassInfo->IsKindOf( CLASSINFO(wxTextCtrl) ) ||
-			pClassInfo->IsKindOf( CLASSINFO(wxComboBox) ) ||
-			pClassInfo->IsKindOf( CLASSINFO(wxOwnerDrawnComboBox) ) ||
-			pClassInfo->IsKindOf( CLASSINFO(wxComboCtrl) ) ||
-			pClassInfo->IsKindOf( CLASSINFO(wxVListBox) )
-			)
+		// Is the object allowed to recieve keys? We have to go done the object hierarchy
+		// since some control (notably Combos) will produce temporary windows which can get
+		// key events.
+		wxWindow* pScanObj = (wxWindow*)pEventObject;
+		while( NULL != pScanObj )
 		{
-			TRACEUSER( "jlh92", _T("Control gets keys") );
-			// Yes, pass on as usual
-			return -1;
-		}
-
+			wxClassInfo* pClassInfo = pScanObj->GetClassInfo();
 #if defined(DEBUG_KEYPRESS_SPEW)
-		while( NULL != pClassInfo )
-		{
-			TRACEUSER( "jlh92", _T("Class %s
"), PCTSTR(pClassInfo->GetClassName()) );
+			{
+				wxClassInfo *pTmpInfo = pClassInfo;
+				while( NULL != pTmpInfo )
+				{
+					TRACEUSER( "jlh92", _T("Class %s
"), PCTSTR(pTmpInfo->GetClassName()) );
+		
+					PCTSTR	pszName = pTmpInfo->GetBaseClassName1();
+					pTmpInfo = NULL == pszName ? NULL : wxClassInfo::FindClass( pszName );
+				}
+				TRACEUSER( "jlh92", _T("----------------------
") );
+			}
+#endif
 
-			PCTSTR	pszName = pClassInfo->GetBaseClassName1();
-			pClassInfo = NULL == pszName ? NULL : wxClassInfo::FindClass( pszName );
+			if( pClassInfo->IsKindOf( CLASSINFO(wxTextCtrl) ) ||
+				pClassInfo->IsKindOf( CLASSINFO(wxComboBox) ) ||
+				pClassInfo->IsKindOf( CLASSINFO(wxOwnerDrawnComboBox) ) ||
+				pClassInfo->IsKindOf( CLASSINFO(wxComboCtrl) )
+				)
+			{
+				TRACEUSER( "jlh92", _T("Control gets keys") );
+				// Yes, pass on as usual
+				return -1;
+			}
+
+			pScanObj = pScanObj->GetParent();
 		}
-#endif
 
 		// Scan down ancestors looking for either wxPanels (always non-modal) and
 		// wxDailogs (can be modal, so we check)


Xara