Property Page won't call OnApply() or OnKillActive()
Author |
Message |
news.easynet.co.u #1 / 4
|
 Property Page won't call OnApply() or OnKillActive()
Hello, I have a property page class derived from CSnapInPropertyPageImpl. When I run the program and display the property page and subsequently close it by clicking on the Ok button, everything works fine and the OnApply() function gets called. However when I put in BEGIN_MSG_MAP() and END_MSG_MAP() in my class header file the OnApply function does not get called at all. This also applies to the OnKillActive() method. Thanks for any help anybody can provide. For reference my class definition is below: class CSetLogLevelPage : public CSnapInPropertyPageImpl<CSetLogLevelPage>, public CWinDataExchange<CSetLogLevelPage> { public : CSetLogLevelPage(long lNotifyHandle, bool bDeleteHandle = false, TCHAR* pTitle = NULL) : CSnapInPropertyPageImpl<CSetLogLevelPage> (pTitle), m_lNotifyHandle(lNotifyHandle), m_bDeleteHandle(bDeleteHandle) // Should be true for only page. { } ~CSetLogLevelPage() { if (m_bDeleteHandle) MMCFreeNotifyHandle(m_lNotifyHandle); } enum { IDD = IDD_SETLOGLEVEL }; BEGIN_MSG_MAP(CSetLogLevelPage) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) END_MSG_MAP() BEGIN_DDX_MAP(CSetLogLevelPage) DDX_TEXT(IDC_LOGLEVELTXT,m_nLogLevel) END_DDX_MAP() HRESULT PropertyChangeNotify(long param) { return MMCPropertyChangeNotify(m_lNotifyHandle, param); } // Set the finish button to be displayed LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { SetModified( TRUE ); USES_CONVERSION; ATLASSERT(::IsWindow(m_hWnd)); ATLASSERT(GetParent() != NULL); DoDataExchange(FALSE); // Load data values to screen ::PostMessage(GetParent(), PSM_SETWIZBUTTONS, 0, PSWIZB_FINISH); return TRUE; } // virtual BOOL OnFinish(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); public: BOOL OnApply(); BOOL OnKillActive(); long m_lNotifyHandle; bool m_bDeleteHandle; CConfigData *m_nDataObj; public: CString m_nLogLevel; protected: CContainedWindowT<WTL::CUpDownCtrl> m_CLogLevelSpin; Quote: };
|
Sun, 11 Jul 2004 01:27:04 GMT |
|
 |
news.easynet.co.u #2 / 4
|
 Property Page won't call OnApply() or OnKillActive()
I forgot to put in a question on my last post, Does anyone know why this behaviour is happening and how do I get around it? Also I'm using the WTL and not MFC so that might have some relevance. Thanks, John
Quote: > Hello, > I have a property page class derived from CSnapInPropertyPageImpl. When I > run the program and display the property page and subsequently close it by > clicking on the Ok button, everything works fine and the OnApply() function > gets called. > However when I put in BEGIN_MSG_MAP() and END_MSG_MAP() in my class header > file the OnApply function does not get called at all. This also applies to > the OnKillActive() method. > Thanks for any help anybody can provide. > For reference my class definition is below: > class CSetLogLevelPage : public CSnapInPropertyPageImpl<CSetLogLevelPage>, > public CWinDataExchange<CSetLogLevelPage> > { > public : > CSetLogLevelPage(long lNotifyHandle, bool bDeleteHandle = false, TCHAR* > pTitle = NULL) : > CSnapInPropertyPageImpl<CSetLogLevelPage> (pTitle), > m_lNotifyHandle(lNotifyHandle), > m_bDeleteHandle(bDeleteHandle) // Should be true for only page. > { > } > ~CSetLogLevelPage() > { > if (m_bDeleteHandle) > MMCFreeNotifyHandle(m_lNotifyHandle); > } > enum { IDD = IDD_SETLOGLEVEL }; > BEGIN_MSG_MAP(CSetLogLevelPage) > MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) > END_MSG_MAP() > BEGIN_DDX_MAP(CSetLogLevelPage) > DDX_TEXT(IDC_LOGLEVELTXT,m_nLogLevel) > END_DDX_MAP() > HRESULT PropertyChangeNotify(long param) > { > return MMCPropertyChangeNotify(m_lNotifyHandle, param); > } > // Set the finish button to be displayed > LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& > bHandled) > { > SetModified( TRUE ); > USES_CONVERSION; > ATLASSERT(::IsWindow(m_hWnd)); > ATLASSERT(GetParent() != NULL); > DoDataExchange(FALSE); // Load data values to screen > ::PostMessage(GetParent(), PSM_SETWIZBUTTONS, 0, PSWIZB_FINISH); > return TRUE; > } > // virtual BOOL OnFinish(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& > bHandled); > public: > BOOL OnApply(); > BOOL OnKillActive(); > long m_lNotifyHandle; > bool m_bDeleteHandle; > CConfigData *m_nDataObj; > public: > CString m_nLogLevel; > protected: > CContainedWindowT<WTL::CUpDownCtrl> m_CLogLevelSpin; > };
|
Sun, 11 Jul 2004 01:35:55 GMT |
|
 |
Vadim Melni #3 / 4
|
 Property Page won't call OnApply() or OnKillActive()
Hello, You should redirect unhandled messages to CSnapInPropertyPageImpl base class, e.g: BEGIN_MSG_MAP(CSetLogLevelPage) MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) CHAIN_MSG_MAP(CSnapInPropertyPageImpl<CSetLogLevelPage>) END_MSG_MAP() -- Best regards, Vadim Melnik, _____________________ http://www.docsultant.com/
Quote: > I forgot to put in a question on my last post, > Does anyone know why this behaviour is happening and how do I get around it? > Also I'm using the WTL and not MFC so that might have some relevance. > Thanks, > John
> > Hello, > > I have a property page class derived from CSnapInPropertyPageImpl. When I > > run the program and display the property page and subsequently close it by > > clicking on the Ok button, everything works fine and the OnApply() > function > > gets called. > > However when I put in BEGIN_MSG_MAP() and END_MSG_MAP() in my class header > > file the OnApply function does not get called at all. This also applies to > > the OnKillActive() method. > > Thanks for any help anybody can provide. > > For reference my class definition is below: > > class CSetLogLevelPage : public
CSnapInPropertyPageImpl<CSetLogLevelPage>, Quote: > > public CWinDataExchange<CSetLogLevelPage> > > { > > public : > > CSetLogLevelPage(long lNotifyHandle, bool bDeleteHandle = false, TCHAR* > > pTitle = NULL) : > > CSnapInPropertyPageImpl<CSetLogLevelPage> (pTitle), > > m_lNotifyHandle(lNotifyHandle), > > m_bDeleteHandle(bDeleteHandle) // Should be true for only page. > > { > > } > > ~CSetLogLevelPage() > > { > > if (m_bDeleteHandle) > > MMCFreeNotifyHandle(m_lNotifyHandle); > > } > > enum { IDD = IDD_SETLOGLEVEL }; > > BEGIN_MSG_MAP(CSetLogLevelPage) > > MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) > > END_MSG_MAP() > > BEGIN_DDX_MAP(CSetLogLevelPage) > > DDX_TEXT(IDC_LOGLEVELTXT,m_nLogLevel) > > END_DDX_MAP() > > HRESULT PropertyChangeNotify(long param) > > { > > return MMCPropertyChangeNotify(m_lNotifyHandle, param); > > } > > // Set the finish button to be displayed > > LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& > > bHandled) > > { > > SetModified( TRUE ); > > USES_CONVERSION; > > ATLASSERT(::IsWindow(m_hWnd)); > > ATLASSERT(GetParent() != NULL); > > DoDataExchange(FALSE); // Load data values to screen > > ::PostMessage(GetParent(), PSM_SETWIZBUTTONS, 0, PSWIZB_FINISH); > > return TRUE; > > } > > // virtual BOOL OnFinish(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& > > bHandled); > > public: > > BOOL OnApply(); > > BOOL OnKillActive(); > > long m_lNotifyHandle; > > bool m_bDeleteHandle; > > CConfigData *m_nDataObj; > > public: > > CString m_nLogLevel; > > protected: > > CContainedWindowT<WTL::CUpDownCtrl> m_CLogLevelSpin; > > };
|
Sun, 11 Jul 2004 06:11:44 GMT |
|
 |
news.easynet.co.u #4 / 4
|
 Property Page won't call OnApply() or OnKillActive()
Cheers Vadim, That worked a treat.
Quote: > Hello, > You should redirect unhandled messages to CSnapInPropertyPageImpl base > class, e.g: > BEGIN_MSG_MAP(CSetLogLevelPage) > MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) > CHAIN_MSG_MAP(CSnapInPropertyPageImpl<CSetLogLevelPage>) > END_MSG_MAP() > -- > Best regards, > Vadim Melnik, > _____________________ > http://www.docsultant.com/
> > I forgot to put in a question on my last post, > > Does anyone know why this behaviour is happening and how do I get around > it? > > Also I'm using the WTL and not MFC so that might have some relevance. > > Thanks, > > John
> > > Hello, > > > I have a property page class derived from CSnapInPropertyPageImpl. When > I > > > run the program and display the property page and subsequently close it > by > > > clicking on the Ok button, everything works fine and the OnApply() > > function > > > gets called. > > > However when I put in BEGIN_MSG_MAP() and END_MSG_MAP() in my class > header > > > file the OnApply function does not get called at all. This also applies > to > > > the OnKillActive() method. > > > Thanks for any help anybody can provide. > > > For reference my class definition is below: > > > class CSetLogLevelPage : public > CSnapInPropertyPageImpl<CSetLogLevelPage>, > > > public CWinDataExchange<CSetLogLevelPage> > > > { > > > public : > > > CSetLogLevelPage(long lNotifyHandle, bool bDeleteHandle = false, TCHAR* > > > pTitle = NULL) : > > > CSnapInPropertyPageImpl<CSetLogLevelPage> (pTitle), > > > m_lNotifyHandle(lNotifyHandle), > > > m_bDeleteHandle(bDeleteHandle) // Should be true for only page. > > > { > > > } > > > ~CSetLogLevelPage() > > > { > > > if (m_bDeleteHandle) > > > MMCFreeNotifyHandle(m_lNotifyHandle); > > > } > > > enum { IDD = IDD_SETLOGLEVEL }; > > > BEGIN_MSG_MAP(CSetLogLevelPage) > > > MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) > > > END_MSG_MAP() > > > BEGIN_DDX_MAP(CSetLogLevelPage) > > > DDX_TEXT(IDC_LOGLEVELTXT,m_nLogLevel) > > > END_DDX_MAP() > > > HRESULT PropertyChangeNotify(long param) > > > { > > > return MMCPropertyChangeNotify(m_lNotifyHandle, param); > > > } > > > // Set the finish button to be displayed > > > LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& > > > bHandled) > > > { > > > SetModified( TRUE ); > > > USES_CONVERSION; > > > ATLASSERT(::IsWindow(m_hWnd)); > > > ATLASSERT(GetParent() != NULL); > > > DoDataExchange(FALSE); // Load data values to screen > > > ::PostMessage(GetParent(), PSM_SETWIZBUTTONS, 0, PSWIZB_FINISH); > > > return TRUE; > > > } > > > // virtual BOOL OnFinish(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& > > > bHandled); > > > public: > > > BOOL OnApply(); > > > BOOL OnKillActive(); > > > long m_lNotifyHandle; > > > bool m_bDeleteHandle; > > > CConfigData *m_nDataObj; > > > public: > > > CString m_nLogLevel; > > > protected: > > > CContainedWindowT<WTL::CUpDownCtrl> m_CLogLevelSpin; > > > };
|
Sun, 11 Jul 2004 18:26:12 GMT |
|
|
|