Handling mouse doubleclick in a CEdit

My CFormView class needs to handle the WM_LBUTTONDBLCLICK message from a CEdit control.  How can I effect this ?
xn12z9iAsked:
Who is Participating?
 
mikeblasConnect With a Mentor Commented:
Actually, the sample shows you exactly what you need to do.

If you don't think it does, you'll need to be more explicit about the difference you perceve between what you're asking and exactly what the sample I wrote for you does.

B ekiM

0
 
nil_dibCommented:
Your CEdit control is used within an CEditView?
0
 
mikeblasCommented:
You need to subclass the edit control with your own CEdit-derived class.  Then, in that subclassing, just handle WM_LBUTTONDBLCLICK messages.

See the DOUBLEEDIT.ZIP sample at http://www.nwlink.com/~mikeblas/samples/ for complete source code to do what you want.

B ekiM
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
xn12z9iAuthor Commented:
This isn't quite what I need to know. What I need is a way for the CFormView class to handle any double-click events that occur in the CEdit client area.  Thanks, though!
0
 
xn12z9iAuthor Commented:
OK. What I need is for the CFormView (the control's parent) to receive notification that a double-click event has occurred in a CEdit control. What I saw in your code sample was the double click event being handled by the CEdit derived class (i.e., the message map was in the CEdit class, etc). Please let me know if what I want to do is doable with your sample code. Thanks for your help !
0
 
mikeblasCommented:
When you double-click on an edit control, Windows sends the doulbe-click message (WM_LBUTTONDBLCLK) to the edit control. The edit control does not send a parent notification as a result of the message.

Thus, you need to subclass the control and handle the WM_LBUTTONDBLCLK to know that the control has been double-clicked.  If you want to send a message to the parent in response to the message, you're completely free to do so.

In my sample, I post a message box.  If you want to send a message, juts remove the message box call. Then, you can get the parent with a call to GetParent(), then send whatever message you would like to the parent.

B ekiM


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.