Solved

Handling mouse doubleclick in a CEdit

Posted on 1999-01-14
6
1,020 Views
Last Modified: 2013-11-20
My CFormView class needs to handle the WM_LBUTTONDBLCLICK message from a CEdit control.  How can I effect this ?
0
Comment
Question by:xn12z9i
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:nil_dib
ID: 1327705
Your CEdit control is used within an CEditView?
0
 
LVL 11

Expert Comment

by:mikeblas
ID: 1327706
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
 

Author Comment

by:xn12z9i
ID: 1327707
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Accepted Solution

by:
mikeblas earned 100 total points
ID: 1327708
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
 

Author Comment

by:xn12z9i
ID: 1327709
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
 
LVL 11

Expert Comment

by:mikeblas
ID: 1327710
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question