Edit Control on View not getting Del key
Andrew Nix -- anix@tqs.win-uk.net Friday, March 01, 1996 Hello all, I'm using VC1.51 through Win95 and Win3.1 with access to MSDN. I have an edit control placed on the screen ready to edit some text. So I have; m_pEdit = new CMyEdit(); CRect rect= CRect(100,500,300,520); m_pEdit->Create(WS_CHILD | WS_EX_TRANSPARENT| ES_CENTER | ES_MULTILINE , rect, this, IDC_EDIT); and then I trap messages through CMyEdit::OnKeyUp where I can look for return etc. Everything works fine until.... I press 'delete' which is then passed straight to the OnEditClear menu entry which kindly deleted the object I was editing!! Of course this is due to the shortcut of 'Del'. The message stops there and is not passed down to the edit control. Have I made a mistake in; 1. Subclassing the edit control 2. Handling the CMyEdit messages 3. Handling the keyboard shortcut on the menu MSDN kindly gives me 880 topics to look through none of which is any good. What is the best book on actual 'proper practical' programming examples that this kind of thing will be in. Many thanks for your help. Andrew Nix anix@tqs.win-uk.net
beriksen@cda.com Monday, March 04, 1996 I capture the backspace key in OnKeyDown (which also clears the selection by default) and my implementation (which sounds like yours) has no problems. Your problem might be that you need to capture OnKeyDown instead of OnKeyUp. Most of the default behaviours happen on OnKeyDown, so, if you do something at OnKeyUp time, you've already missed your chance to do something different than the default. ______________________________ Reply Separator _________________________________ Subject: Edit Control on View not getting Del key Author: mfc-l@netcom.com at Internet_Mail Date: 3/4/96 5:59 AM Hello all, I'm using VC1.51 through Win95 and Win3.1 with access to MSDN. I have an edit control placed on the screen ready to edit some text. So I have; m_pEdit = new CMyEdit(); CRect rect= CRect(100,500,300,520); m_pEdit->Create(WS_CHILD | WS_EX_TRANSPARENT| ES_CENTER | ES_MULTILINE , rect, this, IDC_EDIT); and then I trap messages through CMyEdit::OnKeyUp where I can look for return etc. Everything works fine until.... I press 'delete' which is then passed straight to the OnEditClear menu entry which kindly deleted the object I was editing!! Of course this is due to the shortcut of 'Del'. The message stops there and is not passed down to the edit control. Have I made a mistake in; 1. Subclassing the edit control 2. Handling the CMyEdit messages 3. Handling the keyboard shortcut on the menu MSDN kindly gives me 880 topics to look through none of which is any good. What is the best book on actual 'proper practical' programming examples that this kind of thing will be in. Many thanks for your help. Andrew Nix anix@tqs.win-uk.net
| Вернуться в корень Архива |