[vtkusers] How to capture mouse events in VTK

shijith shijith at ddd.co.jp
Mon Oct 18 06:49:21 EDT 2004


Hi Ingo,
Thanks again.
the code is same in the Windproc()as .
i put break point and checked..it doent enter in to it..

but when i tranlated message from PreTralateMessage(), it enters into
it!!!.. what i did is
something like this...

BOOL CVtkMDIView::PreTranslateMessage(MSG* pMsg)
{
	if(pMsg->message ==WM_LBUTTONDOWN)
	{
		SendMessage(pMsg->message,pMsg->wParam,pMsg->lParam);
		return TRUE;
	}

	return CView::PreTranslateMessage(pMsg);
}

i donno why it was not entering initially...
anyway its ok for the time being.
Thanks a lot.
shijith.


-----Original Message-----
From: de Boer Ingo [mailto:I.deBoer at polytec.de]
Sent: Monday, October 18, 2004 5:51 PM
To: shijith; vtkusers at vtk.org
Subject: RE: [vtkusers] How to capture mouse events in VTK


Look at the view class:

LRESULT CvtkMDIView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
		case WM_LBUTTONDOWN:
		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->pvtkWin32RenderWI->GetInitialized())
		{
			return vtkHandleMessage2(this->GetSafeHwnd(), message, wParam, lParam,
this->pvtkWin32RenderWI);
		}
		break;
	}

	return CView::WindowProc(message, wParam, lParam);
}

This does it all...
I don't know, what is wrong? This works...
Did you set a breakpoint to check it ?

greets
 Ingo


---
Dr.-Ing. Ingo H. de Boer

Polytec GmbH
Polytec-Platz 1-7, 76337 Waldbronn, Germany
phone: ++49 7243 604 106
fax  : ++49 7243 604 255

>
> Hi Ingo,
> Thanks for your reply.
> I have found an MFC example (vtkMDI).
> but while on lbuttondown, it doesnt go into 'case WM_LBUTTONDOWN:' of
> winproc function.
> do i miss something?
> Thanks in advance.
> shijith






More information about the vtkusers mailing list