/** *In case of implementation swallow the OnKeyDown event. *If the event is swallowed, implementation may do other unexpected things, which *is not the control means to do. */ FX_BOOL CPWL_Edit::IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag) { FX_BOOL bCtrl = IsCTRLpressed(nFlag); FX_BOOL bAlt = IsALTpressed(nFlag); if (bCtrl && !bAlt) { // hot keys for edit control. switch (nKeyCode) { case 'C': case 'V': case 'X': case 'A': case 'Z': return TRUE; default: break; } } // control characters. switch (nKeyCode) { case FWL_VKEY_Escape: case FWL_VKEY_Back: case FWL_VKEY_Return: case FWL_VKEY_Space: return TRUE; default: return FALSE; } }
/** *In case of implementation swallow the OnKeyDown event. *If the event is swallowed, implementation may do other unexpected things, which *is not the control means to do. */ bool CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { bool bCtrl = IsCTRLpressed(nFlag); bool bAlt = IsALTpressed(nFlag); if (bCtrl && !bAlt) { // hot keys for edit control. switch (nKeyCode) { case 'C': case 'V': case 'X': case 'A': case 'Z': return true; default: break; } } // control characters. switch (nKeyCode) { case FWL_VKEY_Escape: case FWL_VKEY_Back: case FWL_VKEY_Return: case FWL_VKEY_Space: return true; default: return false; } }
FX_BOOL CPWL_EditCtrl::OnChar(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) return TRUE; CPWL_Wnd::OnChar(nChar, nFlag); // FILTER switch (nChar) { case 0x0A: case 0x1B: return FALSE; default: break; } FX_BOOL bCtrl = IsCTRLpressed(nFlag); FX_BOOL bAlt = IsALTpressed(nFlag); FX_BOOL bShift = IsSHIFTpressed(nFlag); uint16_t word = nChar; if (bCtrl && !bAlt) { switch (nChar) { case 'C' - 'A' + 1: CopyText(); return TRUE; case 'V' - 'A' + 1: PasteText(); return TRUE; case 'X' - 'A' + 1: CutText(); return TRUE; case 'A' - 'A' + 1: SelectAll(); return TRUE; case 'Z' - 'A' + 1: if (bShift) Redo(); else Undo(); return TRUE; default: if (nChar < 32) return FALSE; } } if (IsReadOnly()) return TRUE; if (m_pEdit->IsSelected() && word == FWL_VKEY_Back) word = FWL_VKEY_Unknown; Clear(); switch (word) { case FWL_VKEY_Back: Backspace(); break; case FWL_VKEY_Return: InsertReturn(); break; case FWL_VKEY_Unknown: break; default: InsertWord(word, GetCharSet()); break; } return TRUE; }