Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Assigning a CLICK event to an CEdit box

Posted on 1997-08-21
4
Medium Priority
?
387 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
[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
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 200 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this post we will learn different types of Android Layout and some basics of an Android App.
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

604 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