Solved

Custom CDateTimeCtrl notification messages

Posted on 2003-11-09
6
1,351 Views
Last Modified: 2013-11-20
I wrote class CMyTimePicker : public CDateTimeCtrl {...}
It has a handler for DateTime Change message:
ON_NOTIFY_REFLECT(DTN_DATETIMECHANGE, OnDatetimechange)
...
void CMyTimePicker::OnDatetimechange(NMHDR* pNMHDR, LRESULT* pResult)
{
   //do smth
   *pResult = 0;
}
I also need to notify parent dialog about this message. How to do this?
Regular handler in parent dialog does not resond if I overrride it in my derived class:
ON_NOTIFY(DTN_DATETIMECHANGE, IDC_DATETIMEPICKER1, OnDatetimechangeDatetimepicker1)
void CMyDlg::OnDatetimechangeDatetimepicker1(NMHDR* pNMHDR, LRESULT* pResult)
{
   // Does not come here anymore      
   *pResult = 0;
}
Thank you
0
Comment
Question by:stkash
  • 2
6 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 50 total points
ID: 9709791
See TN062: Message Reflection for Windows Controls

If, in your parent window class, you supply a handler for a specific WM_NOTIFY message or a range of WM_NOTIFY messages, your handler will be called only if the child control sending those messages does not have a reflected message handler through ON_NOTIFY_REFLECT().

This is what happens in your project.
And this is what you need:

If you use ON_NOTIFY_REFLECT_EX() in your message map, your message handler may or may not allow the parent window to handle the message. If the handler returns TRUE, the message will be handled by the parent as well, while a call that returns FALSE does not allow the parent to handle it. Note that the reflected message is handled before the notification message.

Use this:
ON_NOTIFY_REFLECT_EX( wNotifyCode, memberFxn )

afx_msg BOOL memberFxn ( NMHDR * pNotifyStruct, LRESULT* result );
0
 

Author Comment

by:stkash
ID: 9709850
very strange but it works in opposite way:
if the memberFxn returns FALSE - parent receives the message, if TRUE - it does not receive it.
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 9709937
Yes, this is default behaviour. Possibly error in the Technical Note.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best tools for Backup and restore of Wordpress site 6 55
Hibernate methods 2 68
sumHeights  challenge 17 66
Making an alias 7 81
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 …
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.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 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