Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > General Discussion
  New Posts New Posts RSS Feed - Command handlers in MDI view?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Command handlers in MDI view?

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: Command handlers in MDI view?
    Posted: 07 September 2006 at 2:07pm

In an SDI App you simple put all command handlers (menu items etc) in your CMyView.cpp file. This is possible thanks to this:

BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
    TRACE0( " CMainFrame::OnCmdMsg() entered\n" );
    // let the view have first crack at the command
    if (m_wndView.OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
        return TRUE;
    // otherwise, do default handling
    return CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
 
Now, how do I do that in an MDI app (with a ribbon bar)? For instance, if a menu item says "print", I want to print the active view. That is, I want to handle this command in that very instance of the view.
 
Suggestions?
Thanks!
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2007 at 6:43pm
This is handled internally. The active view will get the first crack at the command, as far as I know.
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.