Solved

Adding new message

Posted on 1998-12-02
5
198 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
  • 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 50 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a Shell script to start a service checking the port 6 52
How to determine file rename from EventLog ? 2 54
haveThree challenge 22 121
changeXy challenge 13 87
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

791 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