Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - PopupMenu - messages not routing correctl
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

PopupMenu - messages not routing correctl

 Post Reply Post Reply
Author
Message
craig View Drop Down
Groupie
Groupie


Joined: 11 August 2005
Location: United States
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote craig Quote  Post ReplyReply Direct Link To This Post Topic: PopupMenu - messages not routing correctl
    Posted: 09 June 2006 at 7:14pm
I've create a CXTPPopupMenu with several controls on it.

I track it with CXTPCommandBars::TrackPopupMenu(pColorBar, 0, rcItem.left, rcItem.bottom, m_pMsgWnd);

  The controls such as a simple button are generating messages that are recieved by m_pMsgWnd, but any of the controls that use ON_XTP_EXECUTE don't receive any messages.

How do I get my ON_XTP_EXECUTE messages to route to the parent window defined in m_pMsgWnd?

Thanks,
Craig



Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 10 June 2006 at 9:27am

Hello,

2 solutions:

m_pMsgWnd must be such class CXTPCommandBarsSiteBase<CParentWndClass>

or add

virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult)
 {
  if (message == WM_XTP_COMMAND)
  {
   LRESULT lResult = FALSE;
   NMHDR* pNMHDR = (NMHDR*)lParam;

   UINT nID = (UINT)pNMHDR->idFrom;
   int nCode = pNMHDR->code;

   AFX_NOTIFY notify;
   notify.pResult = &lResult;
   notify.pNMHDR = pNMHDR;
   if (OnCmdMsg(nID, MAKELONG(nCode, WM_NOTIFY), &notify, NULL))
   {
    *pResult = lResult;
    return TRUE;
   }
   return FALSE;
  }

  return TBase::OnWndMsg(message, wParam, lParam, pResult);
 }

to your m_pMsgWnd class.

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
craig View Drop Down
Groupie
Groupie


Joined: 11 August 2005
Location: United States
Status: Offline
Points: 44
Post Options Post Options   Thanks (0) Thanks(0)   Quote craig Quote  Post ReplyReply Direct Link To This Post Posted: 10 June 2006 at 1:50pm
Thanks Oleg.  The first method worked.

I tryed the second method too but it didn't work.  In the return statement, what is TBase?

My class derives from CWnd, so I tried changing the return statement to return CWnd::OnWndMsg(...) but the method appears to be virtual.  The error I receive is:

c:\vault\FreeWorldDesktop\FreeWorld\RgbaColorMenuGridItemWnd .cpp(65): error C2723: 'CRgbaColorMenuGridItemWnd::OnWndMsg' : 'virtual' storage-class specifier illegal on function definition

I have it all working, so you don't have to reply.  I just thought it might be helpful to catalog the alternatives so the next guy wouldn't have to bug you.  :-)

Thanks,
Craig



Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.