Print Page | Close Window

PopupMenu - messages not routing correctl

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=4387
Printed Date: 10 November 2025 at 5:52pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: PopupMenu - messages not routing correctl
Posted By: craig
Subject: PopupMenu - messages not routing correctl
Date 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






Replies:
Posted By: Oleg
Date 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


Posted By: craig
Date 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






Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net