?
Solved

Adding new message

Posted on 1998-12-02
5
Medium Priority
?
216 Views
Last Modified: 2013-11-20
How do I add a new message to a control?
For e.g.The Edit Box control does not have Mouse Double
Click Message map entry in the Class Wizard. How do I add this?

Thaaaanks.
0
Comment
Question by:Thirstyplusplus
[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
5 Comments
 
LVL 1

Expert Comment

by:Bridge
ID: 1325623
You should be able to access the WM_LBUTTONDBLCLK for an overridden CEdit object through Class Wizard.
Rebuild the class wizard database and try again.
0
 
LVL 3

Accepted Solution

by:
plaroche earned 200 total points
ID: 1325624
It's not as simple as adding that message to classwizard. An edit box notifies its parent of its content/state changes, an edit box does not care to tell its parent about mouse events, but it does care to tell when it gets the focus, maybe following a mouse click.

The only way to do this is to derive your own class from CEdit. In that implementation you will overrid the double-click handler. In that override you might want to tell the parent of that event.

To use your own edit box in the dialog you need to include your header file in the dialog. Then add a member variable of type CEdit. In the generated classwizard entry replace the CEdit by CMyEdit.
0
 

Author Comment

by:Thirstyplusplus
ID: 1325625

In Class Wizrd generated message map entries message handlers can
be selectively attached or deleted at will for a given Control.

In my application I derived CMyEdit from CEdit and added the
WM_LBUTTONDBLCLK message. Now every edit control created from
'CMyedit' invoke this new message handler. This is undesirable
in certain circumstances.

Does that mean I have to derive a new class every time I need
different event handler for the same control?

Thanks.



 

 
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1325626
You could code your control to know what it has or doesn't have to intercept.  But it is not that penalizing to override these handlers and post them to the parent. Just code your parent so it takes care of what it needs from each control selectively.
0
 

Author Comment

by:Thirstyplusplus
ID: 1325627
Thank you plaroche.





 

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

800 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