Solved

How to get a Double Click Event for CEdit box?

Posted on 2002-07-26
2
690 Views
Last Modified: 2013-11-20
In Visual basic(VB) we have double click event for Text box (Edit box). But in Visual C++ MFC we don't have a double click event for edit box. All we have for this are SetFocus, KillFocus, Change etc. Is there any way we could get this double click event for Edit box like VB?
0
Comment
Question by:AniBala
2 Comments
 
LVL 8

Accepted Solution

by:
fl0yd earned 75 total points
ID: 7181207
It is inherited from the CWnd-parent. The function is called OnLButtonDblClick.
0
 
LVL 8

Expert Comment

by:VinExpert
ID: 7183210
Hi,

Follow the steps to get the Double click event for the edit box.

1. Go to class wizard and add a new class say CTestEdit and derive it form CEdit class.

2. Using class wizard, go to member variables tab and add a member variable of type "control" and "CTestEdit" to the edit box id, say IDC_TEST_EDIT

3. As soon as u add a control type of CTestEdit, the classwizard will ask u to add the TestEdit.h to the zzzDlg.h file, where zzzDlg.h is ur dialog class header file on which u have placed the edit control.

4. Open the zzzDlg.h file and include "TestEdit.h" file to it.

5. Now go to class wizard and select the CTestEdit class. Then select WM_LBUTTONDBCLK message from "messages" list. Add the function to that message.

6. Now open the TestEdit.cpp file and u will find the OnLButtonDbClk(...) function. U add ur code here. say just AfxMessageBox("Edit double Clicked"); Now run and double click, u will see the message box pop up.

Now u can change the behaviour to whatever u want. This process is known as "Subclassing" and using this method u can subclass the controls and get the behaviour of ur desire.

Try it out.
VinExpert
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

896 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now