[vtkusers] vtkRenderWindowInteractor does not process key events

Daniel Lüken d.lueken at stud.fh-dortmund.de
Thu Mar 29 18:15:27 EDT 2007


Thanks! That worked!

Here are some codesnippets for that solution:

LRESULT CALLBACK wndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam)
{
...
switch(message)
{
...
case WM_SETFOCUS:
SetFocus(theVTKApp->getWnd());
return 0;
break;
...
}
}

HWND myVTKApp::getWnd()
{
return (renWin != NULL) ? (HWND)renWin->GetGenericWindowId() : 0;
}

Daniel

----- Original Message ----- 
From: "David Cole" <david.cole at kitware.com>
To: "Daniel Lüken" <d.lueken at stud.fh-dortmund.de>
Cc: <vtkusers at vtk.org>
Sent: Thursday, March 29, 2007 7:13 PM
Subject: Re: [vtkusers] vtkRenderWindowInteractor does not process key 
events


For the Win32/Windows case, make sure you intercept WM_SETFOCUS in
your parent window and call SetFocus on the VTK child HWND. Otherwise,
the VTK child window will never get keyboard focus.....

I'm not sure what the equivalent Motif thing to do is for you X-windows 
users...

HTH,
David


On 3/29/07, Daniel Lüken <d.lueken at stud.fh-dortmund.de> wrote:
> Hello,
>
> I'm currently getting started using the VTK and ran into a problem. The
> vtkRenderWindowInteractor doesn't process key events when I use the vtk in 
> a
> parent window using renWin->SetParentID(hwnd). Everything works fine when 
> I
> let the VTK create its own window. Mouse events are correctly processed in
> both cases.
> I'm using VTK 5 in a C++ application.
>
> Thanks in advance.
>
> _______________________________________________
> 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