Solved

Assigning a CLICK event to an CEdit box

Posted on 1997-08-21
4
368 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

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 124
Whole sheet autoscrub still needed 19 48
Change owner from userA to server Local Administrators 7 59
zeroMAx challenge 20 88
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

895 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

21 Experts available now in Live!

Get 1:1 Help Now