Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Need to find which MDI DocTemplate owns popup?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Need to find which MDI DocTemplate owns popup?

 Post Reply Post Reply
Author
Message
MichaelN View Drop Down
Senior Member
Senior Member


Joined: 19 September 2006
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote MichaelN Quote  Post ReplyReply Direct Link To This Post Topic: Need to find which MDI DocTemplate owns popup?
    Posted: 16 January 2007 at 5:43pm
I have an MDI app with multiple Doc Templates. I need to know which Doc Template owns the popup, from inside CMainFrame::OnInitCommandsPopup().
 
I can't get to CXTPCommandBar::GetActiveDocTemplate() because it is protected, but that sounds like what I need. Is there any other way to determine which doc template owns the popup from within the MainFrame handler?
 
Thanks,
 
Michael
Back to Top
MichaelN View Drop Down
Senior Member
Senior Member


Joined: 19 September 2006
Status: Offline
Points: 112
Post Options Post Options   Thanks (0) Thanks(0)   Quote MichaelN Quote  Post ReplyReply Direct Link To This Post Posted: 16 January 2007 at 6:00pm
Well, I solved it, but the method seems a little "over the top", if there is a simpler way.
 
I derived a spoof class from CXTPControlBar which uses the CXTPCommandBar::Copy(0 method and has a public method that returns the value of the protected CXTPCommandBar::GetActiveDocTemplate().
 
Inside CMainFrame::OnInitCommandsPopup(). I create an instance of my spoof class and pass it pCommandBar, then call get the DocTemplate from it.
 
Is there a simpler way?
 
Michael
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: 17 January 2007 at 12:56am
Hello,
 
Call GetCommandBars()->GetActiveDocTemplate() method instead.
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.250 seconds.