Quantcast

key press event can't work in MFC

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

key press event can't work in MFC

rivin
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);

Loading...