-
July 8th, 2013, 04:33 AM
#1
Processing Enter and Esc in CEdit
I am using a CEdit control as a child in a CListCtrl for purpose of making each column editable. The application is a dialog based app. My problem is... I have overwritten OnOK and OnCancel in the main dialog so the edit control never receives notifications for Escape or Enter whether in OnChar or PreTranslateMessage and I would like to delete the CEdit control after updating the CListCtrl on Enter. What can I do? I have rewritten this code many many times over the past 4 days and nothing is working.
-
July 8th, 2013, 05:00 AM
#2
Re: Processing Enter and Esc in CEdit
Did you try to subclass CListCtrl and handle LVN_KEYDOWN message in it (in the class derived from CListCtrl)?
Victor Nijegorodov
-
July 8th, 2013, 05:10 AM
#3
Re: Processing Enter and Esc in CEdit
Just tried it. When the edit control has the focus KeyDown messages go to the edit control and either way the keydown still does not receive the enter and escape notification. the message I believe is being killed after the main Dialog receives it. I tried instead of OnOK and OnCancel to process the message in the main dialogs PreTranslateMessage Que and then pass the message on but the PreTranslateMessage won't process the ESCAPE and ENTER and dialog closes anyway.I am really stuck here.
-
July 8th, 2013, 05:16 AM
#4
Re: Processing Enter and Esc in CEdit
Originally Posted by RobNHood
Just tried it. When the edit control has the focus KeyDown messages go to the edit control
Well, then set the edit control styles EN_MULTILINE and EN_WANTRETURN, then handle EN_UPDATE for the edit control and check whether return was clicked (you can use GetKeyState API to do it)
Victor Nijegorodov
-
July 8th, 2013, 05:49 AM
#5
Re: Processing Enter and Esc in CEdit
Okay that does seem to process the RETURN just fine but it still does not handle the ESCAPE how would I go about implementing that in the edit control? Never mind the ESCAPE was routed to the containing dialog so I overrode OnCancel there and redirected it to notify the edit control. Thank you so much for your help everything works great now.
Last edited by RobNHood; July 8th, 2013 at 06:06 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|