[vtkusers] Events in a VC++ SDI View (How can I link to windowsmessages?)

de Boer Ingo I.deBoer at polytec.de
Mon Jun 7 03:59:11 EDT 2004


Hi,

> can somebody tell me how to handle VTK events in a VTK window embedded in a VC++ SDI View.
> I want to use the Windows messages to change the default behavior of vtkRenderWindowInteractor.
> Can somebody show me a simple example?

Make you own Interactor. Overwrite your desired functions. Do the connection
and the initialization.
In you View class overwrite this function somehow like this:

LRESULT CMyView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
{
  switch (message)
  {
    case WM_LBUTTONDOWN: 
    case WM_LBUTTONUP: 
    case WM_MBUTTONDOWN: 
    case WM_MBUTTONUP: 
    case WM_RBUTTONDOWN: 
    case WM_RBUTTONUP: 
    case WM_MOUSEMOVE:
    case WM_TIMER:
    {
      if (m_pvtkWin32RenderWI->GetInitialized())
        vtkHandleMessage2(m_hWnd, message, wParam, lParam, m_pvtkWin32RenderWI);
    }
  break;
  }
  return CView::WindowProc(message, wParam, lParam);
}

Look at the vtkMFC samples shipped with VTK.

greets
  Ingo

---
Dr.-Ing. Ingo H. de Boer

Polytec GmbH
Polytec-Platz 1-7, 76337 Waldbronn, Germany
phone: ++49 7243 604 106
fax  : ++49 7243 604 255



More information about the vtkusers mailing list