[vtkusers] Win32, Intercepting a interactor messages. (Custom interactor)

BURRELL Benjamin Benjamin.Burrell at Tenix.com
Thu Apr 1 19:30:03 EST 2004


I have an application that has a 3D scene and I want to add a feature to be able to go to a 2D type view. How I want to implement it is to move the camera to directing 'overhead' of the scene and I would 'intercept' left mouse button movements and redirect them from calling Rotate() to Pan(). This would give the impression of only giving a 2D perspective even though it is still a 3D scene. I still would like to keep the rest of the standard interactor functionality.

Now I though this WAS going to be easy, that I just insert code show below but it seems like the program never enters any of the case statements other than WM_CHAR and WM_TIMER, and it only enters these when a key on the keyboard is pressed.

Does anyone have any ideas how to do this and how I go about doing a Pan() call?

Is this problem arising from vtkWin32RenderWindowInteractor by default installing a MessageProc callback like mentioned in the class description?
If I stop it from installing a MessageProc callback by calling iren->InstallMessageProcOff() the application still never enters the WM_LBUTTONDOWN case.


LRESULT CVtkMDIView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
	switch ( message )
	{
		//case WM_PAINT: 
		case WM_CLOSE: 
		case WM_LBUTTONDOWN:  // ENTER CODE HERE TO INTERCEPT A LEFT MOUSE BUTTON ACTION AND MOVEMENT.
					       // eg.   if (this->in2Dmode())  { iren->Pan(); }    ???????????
		case WM_LBUTTONUP: 
		case WM_MBUTTONDOWN: 
		case WM_MBUTTONUP: 
		case WM_RBUTTONDOWN: 
		case WM_RBUTTONUP: 
		case WM_MOUSEMOVE:
		case WM_CHAR:
		case WM_TIMER:
			if ( this->mp_iren->GetInitialized() )
			{
				return vtkHandleMessage2(this->m_hWnd, message, wParam, lParam, this->mp_iren);
			}
			break;
	}
	return CView::WindowProc(message, wParam, lParam);
}



Thanks for any help,

Benjamin Burrell



More information about the vtkusers mailing list