[vtkusers] MouseWheel and .NET

Mathieu Malaterre mathieu.malaterre at kitware.com
Wed Mar 8 17:11:44 EST 2006


David Montgomery wrote:
> In VTK 5.0.0 mouse wheel input zooms the trackball interactor as 
> expected when I use a stand alone win32 window. When I parent the VTK 
> graphics window to a .NET Windows Forms component (such as a panel), the 
> mouse wheel input apparently gets consumed by a .NET component. Does 
> anyone know a work-around or setting I should use to get the mouse wheel 
> input to the VTK window?

Be sure to propagate the events down to VTK. Have a look at:

   VTK/Examples/GUI/Win32/SampleMFC/vtkMFCRenderView.cpp

...
// Define our own event handler here
LRESULT vtkMFCRenderView::WindowProc(UINT message, WPARAM wParam, LPARAM 
lParam)
{
   switch (message)
     {
     //case WM_PAINT:
     case WM_LBUTTONDOWN:
     case WM_LBUTTONUP:
     case WM_MBUTTONDOWN:
     case WM_MBUTTONUP:
     case WM_RBUTTONDOWN:
     case WM_RBUTTONUP:
     case WM_MOUSEMOVE:
     case WM_MOUSEWHEEL:
     case WM_CHAR:
     case WM_TIMER:
       if (this->Interactor->GetInitialized())
         {
         return vtkHandleMessage2(this->m_hWnd, message, wParam, lParam,
                                  this->Interactor);
         }
       break;
     }
   return vtkMFCView::WindowProc(message, wParam, lParam);
}
...

HTH
Mathieu



More information about the vtkusers mailing list