#001 void AutocompleteEdit::OnChar(TCHAR ch, UINT repeat_count, UINT flags) { #002 // Don't let alt-enter beep. Not sure this is necessary, as the standard #003 // alt-enter will hit DiscardWMSysChar() and get thrown away, and #004 // ctrl-alt-enter doesn't seem to reach here for some reason? At least not on #005 // my system... still, this is harmless and maybe necessary in other locales. |
#006 if (ch == VK_RETURN && (flags & KF_ALTDOWN)) #007 return; #008 #009 // Escape is processed in OnKeyDown. Don't let any WM_CHAR messages propagate #010 // as we don't want the RichEdit to do anything funky. 下面把ESC键的消息过滤掉。 #011 if (ch == VK_ESCAPE && !(flags & KF_ALTDOWN)) #012 return; #013 下面把TAB键的消息过滤掉。 #014 if (ch == VK_TAB) { #015 // Don't add tabs to the input. #016 return; #017 } #018 这里处理其它有用的按键消息。 #019 HandleKeystroke(GetCurrentMessage()->message, ch, repeat_count, flags); #020 } |
#001 void AutocompleteEdit::HandleKeystroke(UINT message, TCHAR key, #002 UINT repeat_count, UINT flags) { 冻结RichEdit的更新。 #003 ScopedFreeze freeze(this, GetTextObjectModel()); 处理消息变化前的动作。 #004 OnBeforePossibleChange(); 处理消息 #005 DefWindowProc(message, key, MAKELPARAM(repeat_count, flags)); 处理消息变化后的动作。 #006 OnAfterPossibleChange(); #007 } |