[vtkusers] Can't catch double clicks in vtkWin32RenderWindowInteractor

list at kobenetz.de list at kobenetz.de
Wed Mar 21 11:08:05 EDT 2007


VTK 5.0.2, WinXP SP2 on Mac(Intel) with Bootcamp, C++, Visual Studio 2005

Hi,

I'm having some trouble with the vtkWin32RenderWindowInteractor and the
mouse:

1. I can't catch double-clicks
2. The mouse-picking as described in
http://www.vtk.org/Wiki/VTK_Mouse_Picking does not work for me. See
description below.


1. I've tried using vtkRenderWindowInteractor::GetRepeatCount() with the
Default style and the TrackballCamera style. GetRepeatCount does never
return 1.

I've looked through the source and traced back the problem to the
following file and inserted two 'printf's to see if the clicks are beeing
caught:

vtkWin32RenderWindowInteractor.cxx:
---- Line 640

    case WM_LBUTTONDBLCLK:
      me->OnLButtonDown(hWnd,wParam,MAKEPOINTS(lParam).x,MAKEPOINTS(lParam).y,
1);
	  printf ("\n\nDouble-click!\n\n");
      break;

    case WM_LBUTTONDOWN:
      me->OnLButtonDown(hWnd,wParam,MAKEPOINTS(lParam).x,MAKEPOINTS(lParam).y,
0);
	  printf ("\n\nSingle-click!\n\n");
      break;

----

When I double-click the mouse in the RenderWindow I get the "Single-click"
message twice, not the "Double-click" one. Where's the problem?


2. When trying to use the mouse picking as described, "press"-"don't
move"-"release" it always appears that the mouse has been moved in
between:


----
void cb_leftButtonDown( vtkObject *caller, unsigned long eid, void
*clientdata, void *calldata )
{
	MouseMotion = 0;
	cout << "cb_leftButtonDown\n";

	if( iren->GetRepeatCount() == 1 )
	{
		// This never happens anyway ...
		cout << "Double-click!\n";
	}

	style->OnLeftButtonDown();
}

void cb_leftButtonUp( vtkObject *caller, unsigned long eid, void
*clientdata, void *calldata )
{

	cout << "cb_leftButtonUp\n";

	if( MouseMotion == 0 )
	{
		picker->Pick( iren->GetEventPosition()[0], iren->GetEventPosition()[1],
0.0, ren1);
		showPick( 0,0,0,0 ); // Draw some info about picking location ...
	}

	style->OnLeftButtonUp();
}

void cb_mouseMove( vtkObject *caller, unsigned long eid, void *clientdata,
void *calldata )
{
	if( MouseMotion == 0 )
	{
		cout << "Mouse has been moved!";
	}
	MouseMotion = 1;

	style->OnMouseMove();
}
----

What happens is the following: I click and hold the mouse button without
moving the mouse (Optical mouse up in the air). Instantly I get the
Message "cb_leftButtonDown" and a few MILLISECONS later "Mouse has been
moved!". If I click-release fast enough I can manage to get a pick, but
why do I get this unexpected behaviour?

Thanks,

Christoph




More information about the vtkusers mailing list