Solved

Assigning a CLICK event to an CEdit box

Posted on 1997-08-21
4
372 Views
Last Modified: 2013-11-20
I have a VC++ 4.x app that has several edit boxes created with the dialog editor in VC (standard CEdit box). How can I assign a CLICK event to these? CLICK is not a standard stock event, and I cannot seem to add a custom event. Example code would be great. Thanks.

Michael A Knight
0
Comment
Question by:maknight
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1304529
If you want to know when an edit control is clicked on, you can derive a class from CEdit and catch the WM_LBUTTONDOWN message. This message is sent when the user clicks on the edit control.
0
 

Author Comment

by:maknight
ID: 1304530
I have tried this, but if I use ClassWizard to add a Member Variable for the CEdit control of category Control and type KECEditCtrl (the CEdit-derived class), everywhere I click in the dialog (it is a Dialog-based app) runs the ON_WM_LBUTTONDN code in the derived class. This puzzles the heck outta me.
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1304531
This is very puzzling. The only way that could happen is your derived class is the one stealing all of the mouse messages. Make sure there's no reference to CEdit anywhere in your dialog class. Check to make sure no one is explicitly calling your OnLButtonDown function.

0
 

Author Comment

by:maknight
ID: 1304532
I found the culprits. A) Remove the default call from the end of the OnLButtonDn function, B) SetFocus to the edit control. Somehow in the derivation, the system loses light of the fact that it should set focus on the click also. Thanks. I have another related question I just posted if you wanna take a shot at it...

MAK
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Different colored text in ComboBox without Subclassing 8 66
Get filename and folder into excel 7 79
Generic progress indicator 6 117
Work with App store 7 68
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 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