Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Site vs. Owner Confusion
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Site vs. Owner Confusion

 Post Reply Post Reply
Author
Message
pavold View Drop Down
Newbie
Newbie


Joined: 14 May 2007
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote pavold Quote  Post ReplyReply Direct Link To This Post Topic: Site vs. Owner Confusion
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 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
Back to Top
pavold View Drop Down
Newbie
Newbie


Joined: 14 May 2007
Status: Offline
Points: 23
Post Options Post Options   Thanks (0) Thanks(0)   Quote pavold Quote  Post ReplyReply Direct Link To This Post 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?


Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 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
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.188 seconds.