Notifiation Messages for CSpinButtonCtrl in MFC
-
The notification message send to the parent uses the UDN_DELTAPOS notification code (Windows)[^]
Sorry i tried this as follows
ON_NOTIFY_REFLECT(UDN_DELTAPOS,OnSpinContol)
Its throws syntax error and could not find any sample in google to declare the message.
-
Sorry i tried this as follows
ON_NOTIFY_REFLECT(UDN_DELTAPOS,OnSpinContol)
Its throws syntax error and could not find any sample in google to declare the message.
In what class did you implement it? Please, post the exact code snippets!
-
Sorry i tried this as follows
ON_NOTIFY_REFLECT(UDN_DELTAPOS,OnSpinContol)
Its throws syntax error and could not find any sample in google to declare the message.
That is for handling the message by the control class itself when having it derived. To handle the message in the parent do it like you have done already:
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaPos)
-
In what class did you implement it? Please, post the exact code snippets!
BEGIN_MESSAGE_MAP(CMyClass, CScrollView)
ON_NOTIFY_REFLECT(UDN_DELTAPOS,OnSpinContol)
END_MESSAGE_MAP()void CMyClass::OnSpinContol(NMHDR *pNMHDR, LRESULT *pResult)
{}
-
That is for handling the message by the control class itself when having it derived. To handle the message in the parent do it like you have done already:
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN1, OnDeltaPos)
Even tried below one, but no luck. :(
BEGIN_MESSAGE_MAP(CMyClass, CScrollView)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN, OnSpinContol)
END_MESSAGE_MAP()void CMyClass::OnSpinContol(NMHDR *pNMHDR, LRESULT *pResult)
{}
-
BEGIN_MESSAGE_MAP(CMyClass, CScrollView)
ON_NOTIFY_REFLECT(UDN_DELTAPOS,OnSpinContol)
END_MESSAGE_MAP()void CMyClass::OnSpinContol(NMHDR *pNMHDR, LRESULT *pResult)
{}
CMyClass seems to be a parent/owner of the spin control. So there must be ON_NOTIFY macro, not a ON_NOTIFY_REFLECT
-
Even tried below one, but no luck. :(
BEGIN_MESSAGE_MAP(CMyClass, CScrollView)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN, OnSpinContol)
END_MESSAGE_MAP()void CMyClass::OnSpinContol(NMHDR *pNMHDR, LRESULT *pResult)
{}
Sampath579 wrote:
Even tried below one, but no luck. :(
BEGIN_MESSAGE_MAP(CMyClass, CScrollView)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN, OnSpinContol)
END_MESSAGE_MAP()void CMyClass::OnSpinContol(NMHDR *pNMHDR, LRESULT *pResult)
{}
1. Define "no luck". 2. Do you pass the correct control ID (IDC_SPIN)?
-
Even tried below one, but no luck. :(
BEGIN_MESSAGE_MAP(CMyClass, CScrollView)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN, OnSpinContol)
END_MESSAGE_MAP()void CMyClass::OnSpinContol(NMHDR *pNMHDR, LRESULT *pResult)
{}
It is very probably sourced by the creation of your spin control:
m_spin.Create(UDS_HORZ, CRect(0, 0, 50, 50), this, 1011);
That misses the common window style flags like
WS_CHILD | WS_VISIBLE | WS_TABSTOP
. Just out of interest: Why are you creating your controls manually instead of using resource templates? With templates the default settings are initially set in the resource editor so that such errors did not occur. -
Sampath579 wrote:
Even tried below one, but no luck. :(
BEGIN_MESSAGE_MAP(CMyClass, CScrollView)
ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN, OnSpinContol)
END_MESSAGE_MAP()void CMyClass::OnSpinContol(NMHDR *pNMHDR, LRESULT *pResult)
{}
1. Define "no luck". 2. Do you pass the correct control ID (IDC_SPIN)?
Hey Thanks Victor. Its working now.
-
It is very probably sourced by the creation of your spin control:
m_spin.Create(UDS_HORZ, CRect(0, 0, 50, 50), this, 1011);
That misses the common window style flags like
WS_CHILD | WS_VISIBLE | WS_TABSTOP
. Just out of interest: Why are you creating your controls manually instead of using resource templates? With templates the default settings are initially set in the resource editor so that such errors did not occur.Hey Thanks.. Finally its working. The very first thing is i am new to MFC and second is i am creating all dynamic windows and controls based on user input.