don't send wxHelpEvent generated for WM_HELP to all window parents, wxHelpEvent is already propagated upwards implicitely anyhow so in fact we should prevent the default behaviour for it from taking place

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-06-11 21:08:53 +00:00
parent 4387847f65
commit a9c11b71e3

View File

@@ -3000,50 +3000,48 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
#if defined(WM_HELP) #if defined(WM_HELP)
case WM_HELP: case WM_HELP:
{ {
// HELPINFO doesn't seem to be supported on WinCE. // by default, WM_HELP is propagated by DefWindowProc() upwards
// to the window parent but as we do it ourselves already
// (wxHelpEvent is derived from wxCommandEvent), we don't want
// to get the other events if we process this message at all
processed = true;
// WM_HELP doesn't use lParam under CE
#ifndef __WXWINCE__ #ifndef __WXWINCE__
HELPINFO* info = (HELPINFO*) lParam; HELPINFO* info = (HELPINFO*) lParam;
// Don't yet process menu help events, just windows
if ( info->iContextType == HELPINFO_WINDOW ) if ( info->iContextType == HELPINFO_WINDOW )
{ {
#endif #endif // !__WXWINCE__
wxWindowMSW* subjectOfHelp = this; wxHelpEvent helpEvent
bool eventProcessed = false; (
while (subjectOfHelp && !eventProcessed) wxEVT_HELP,
{ GetId(),
wxHelpEvent helpEvent(wxEVT_HELP,
subjectOfHelp->GetId(),
#ifdef __WXWINCE__ #ifdef __WXWINCE__
wxPoint(0,0) wxGetMousePosition(), // what else?
#else #else
wxPoint(info->MousePos.x, info->MousePos.y) wxPoint(info->MousePos.x, info->MousePos.y)
#endif #endif
); );
helpEvent.SetEventObject(this); helpEvent.SetEventObject(this);
eventProcessed =
GetEventHandler()->ProcessEvent(helpEvent); GetEventHandler()->ProcessEvent(helpEvent);
// Go up the window hierarchy until the event is
// handled (or not)
subjectOfHelp = subjectOfHelp->GetParent();
}
processed = eventProcessed;
#ifndef __WXWINCE__ #ifndef __WXWINCE__
} }
else if ( info->iContextType == HELPINFO_MENUITEM ) else if ( info->iContextType == HELPINFO_MENUITEM )
{ {
wxHelpEvent helpEvent(wxEVT_HELP, info->iCtrlId); wxHelpEvent helpEvent(wxEVT_HELP, info->iCtrlId);
helpEvent.SetEventObject(this); helpEvent.SetEventObject(this);
processed = GetEventHandler()->ProcessEvent(helpEvent); GetEventHandler()->ProcessEvent(helpEvent);
} }
//else: processed is already false else // unknown help event?
#endif {
processed = false;
}
#endif // !__WXWINCE__
} }
break; break;
#endif #endif // WM_HELP
#if !defined(__WXWINCE__) #if !defined(__WXWINCE__)
case WM_CONTEXTMENU: case WM_CONTEXTMENU: