Solved

How to get a Double Click Event for CEdit box?

Posted on 2002-07-26
2
705 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
[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
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

Technology Partners: 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: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 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