<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>Re: [vtkusers] MouseWheel and .NET</TITLE>
</HEAD>
<BODY>
<DIV id=idOWAReplyText87474 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>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:<FONT size=2>
<P>OnMouseWheel(</FONT><FONT color=#008080 size=2>MouseEventArgs</FONT><FONT
size=2> e)</FONT></P>
<P>Using the value of e.Delta I directed this method to call the
appropriate MouseWheel method of the VTK interactor as follows:</P><FONT
size=2><FONT size=2>
<P></FONT><FONT color=#0000ff size=2>if</FONT><FONT size=2> (forward) {</P>
<P></FONT><FONT color=#0000ff size=2>this</FONT><FONT
size=2>->trackballCam->OnMouseWheelForward();</P>
<P>} </FONT><FONT color=#0000ff size=2>else </FONT><FONT size=2>{</P>
<P></FONT><FONT color=#0000ff size=2>this</FONT><FONT
size=2>->trackballCam->OnMouseWheelBackward();</P>
<P>}</P></FONT></FONT></FONT></DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Mathieu Malaterre
[mailto:mathieu.malaterre@kitware.com]<BR><B>Sent:</B> Wed 3/8/2006 5:11
PM<BR><B>To:</B> David Montgomery<BR><B>Cc:</B>
vtkusers@vtk.org<BR><B>Subject:</B> Re: [vtkusers] MouseWheel and
.NET<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>David Montgomery wrote:<BR>> In VTK 5.0.0 mouse wheel input
zooms the trackball interactor as<BR>> expected when I use a stand alone
win32 window. When I parent the VTK<BR>> graphics window to a .NET Windows
Forms component (such as a panel), the<BR>> mouse wheel input apparently gets
consumed by a .NET component. Does<BR>> anyone know a work-around or setting
I should use to get the mouse wheel<BR>> input to the VTK window?<BR><BR>Be
sure to propagate the events down to VTK. Have a look at:<BR><BR>
VTK/Examples/GUI/Win32/SampleMFC/vtkMFCRenderView.cpp<BR><BR>...<BR>// Define
our own event handler here<BR>LRESULT vtkMFCRenderView::WindowProc(UINT message,
WPARAM wParam, LPARAM<BR>lParam)<BR>{<BR> switch
(message)<BR> {<BR> //case
WM_PAINT:<BR> case
WM_LBUTTONDOWN:<BR> case
WM_LBUTTONUP:<BR> case
WM_MBUTTONDOWN:<BR> case
WM_MBUTTONUP:<BR> case
WM_RBUTTONDOWN:<BR> case
WM_RBUTTONUP:<BR> case
WM_MOUSEMOVE:<BR> case
WM_MOUSEWHEEL:<BR> case
WM_CHAR:<BR> case
WM_TIMER:<BR> if
(this->Interactor->GetInitialized())<BR>
{<BR> return
vtkHandleMessage2(this->m_hWnd, message, wParam,
lParam,<BR>
this->Interactor);<BR>
}<BR> break;<BR>
}<BR> return vtkMFCView::WindowProc(message, wParam,
lParam);<BR>}<BR>...<BR><BR>HTH<BR>Mathieu<BR></FONT></P></DIV>
</BODY>
</HTML>