Solved

Adding new message

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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
CRON statement to run every 3 minutes except on Monday morning 12am to 2am 7 113
while loop over for loop 7 116
lucky13 challenge 11 158
changeXy challenge 13 93
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

756 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