[vtkusers] key press event can't work in MFC

rivin 619818283 at qq.com
Fri Apr 21 15:12:16 EDT 2017


I've already implement a VTK render window in my MFC window, everything works
well except I have to click the render window again to make the key press
events get called. It seems my MFC window is intercepting the key pressed
events. Is there any method to help me focus the cursor at the render
window?
Clicking the window before entering a key is really annoying.

Here is my code:

this->mainView  = new vtkMFCWindow(this->GetDlgItem(IDC_MAIN_VIEW));
mainView->SetRenderWindow(vtkMainView);
vtkSmartPointer<vtkInteractorStyleImage> imageStyle =
vtkSmartPointer<vtkInteractorStyleImage>::New();

imageStyle->SetInteractionModeToImage3D();

this->mainView->GetInteractor()->SetInteractorStyle(imageStyle);
this->mainView->GetInteractor()->AddObserver(vtkCommand::KeyPressEvent,
slicer);





--
View this message in context: http://vtk.1045678.n5.nabble.com/key-press-event-can-t-work-in-MFC-tp5742941.html
Sent from the VTK - Users mailing list archive at Nabble.com.


More information about the vtkusers mailing list