Print Page | Close Window

Site vs. Owner Confusion

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=8556
Printed Date: 06 October 2024 at 4:26am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Site vs. Owner Confusion
Posted By: pavold
Subject: Site vs. Owner Confusion
Date Posted: 28 October 2007 at 10:06am
Hi,

CXTPCommandBars::TrackPopupMenu has two CWnd* arguments. First one is set to pPopupBar->m_pSite, while the second one goes to m_pOwner.

What's the exact purpose (and distinction) of these arguments?

Originally I thought, that m_pSite is the window that will receive notification/messages from the popup bar controls. I got this idea from the fact that the message sending is perfomed by CXTPControl::NotifySite().

However, recently I have discovered that this is not true and the pOwner is actually the one that will receive the message.


Please explain.

Thanks in advance,
Pavol



Replies:
Posted By: Oleg
Date Posted: 29 October 2007 at 2:17am
Yes, pOwner is window for WM_COMMAND message. if you don't set it - pSite will be used.
Better use non-static version: GetCommandBars()->TrackPopupMenuEx(...);


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: pavold
Date Posted: 29 October 2007 at 3:48am
I have observed a slightly different behavior.

What I'm trying to do is to show a popup menu, that will direct the messages to a concrete window.

If I set only the pSite argument in the TrackPopupMenu, WM_COMMAND message will actually end up in the main CommandBars site (in my case it is CMainFrame).

In other words if pOwner is not specified, global Site is used instead.

Is this expected?




Posted By: Oleg
Date Posted: 29 October 2007 at 4:03am
yes, if you specify some CommandBars object.
 
also you can set TPM_RETURN flag to not send message but use return value from TrackPopupMenu.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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