[vtkusers] Re: Updating VTK window in MFC

Andrew Wilford andrew at artwork.com
Thu Apr 1 22:32:31 EST 2004


Sinan,

If I understand what you are describing, I had a similar problem some time
ago with a non-VTK application which had multiple views. I believe it has to
do with which views receive which messages. The workaround I used was to
subclass the CMainFrame OnCmdMsg event, sending all messages to each view as
follows:

BOOL CMainFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra,
AFX_CMDHANDLERINFO* pHandlerInfo)
{
  if(CFrameWnd::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
    return TRUE;

// dispatch messages to both views (ensures toolbar is always visible)

  CAifvuView* main = ((CAifvuView*)m_Splitter.GetPane(0, m_DesignViewPane));
  if(main->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
    return TRUE;

  CAifvuInfoView* info = ((CAifvuInfoView*)m_Splitter.GetPane(0,
m_InfoViewPane));
  if(info->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo))
    return TRUE;

  return TRUE;
}

My problem was toolbars being disabled depending on which view had the
focus, so maybe it will work for you also.

Good luck!

Andrew Wilford





More information about the vtkusers mailing list