[vtkusers] MouseWheel and .NET
X Z
xf10036 at hotmail.com
Thu Mar 9 13:49:37 EST 2006
>I verified that the focused .NET component consumes the WM_MOUSEWHEEL
>message, and the VTK graphics window would not receive it. <
It does not seem to be the case for me. The vtk did receive the mouse wheel
event as long as the vtk window is in focus. Or is it that you need the
mouse wheel event to be heared by vtk even if a control other than the vtk
window in the form is in focus?
Just curious (or More than...)!
Regards!
Xiaofeng Zhao
http://www.xzing.org
errare humanum est
>From: "David Montgomery" <dmontgomery at gsti3d.com>
>To: "Mathieu Malaterre" <mathieu.malaterre at kitware.com>
>CC: vtkusers at vtk.org
>Subject: RE: [vtkusers] MouseWheel and .NET
>Date: Thu, 9 Mar 2006 12:43:54 -0500
>
>I verified that the focused .NET component consumes the WM_MOUSEWHEEL
>message, and the VTK graphics window would not receive it. I worked around
>this by simply overriding the following .NET method:
>
>OnMouseWheel(MouseEventArgs e)
>
>Using the value of e.Delta I directed this method to call the appropriate
>MouseWheel method of the VTK interactor as follows:
>
>if (forward) {
>
>this->trackballCam->OnMouseWheelForward();
>
>} else {
>
>this->trackballCam->OnMouseWheelBackward();
>
>}
>
>
>________________________________
>
>From: Mathieu Malaterre [mailto:mathieu.malaterre at kitware.com]
>Sent: Wed 3/8/2006 5:11 PM
>To: David Montgomery
>Cc: vtkusers at vtk.org
>Subject: Re: [vtkusers] MouseWheel and .NET
>
>
>
>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
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
>http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
More information about the vtkusers
mailing list