Solved

Adding new message

Posted on 1998-12-02
5
213 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 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