Solved

Adding new message

Posted on 1998-12-02
5
170 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
Comment Utility
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
Comment Utility
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
Comment Utility

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
Comment Utility
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
Comment Utility
Thank you plaroche.





 

0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 86
Folder Comparison 12 52
Detect CR LF to each line 12 137
VBA "SendKeys" Syntax for Multiple Keystrokes 7 97
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now