[vtkusers] MouseMoveEvent bug in Cocoa

Sean McBride sean at rogue-research.com
Mon Aug 17 14:45:40 EDT 2009


On 8/17/09 6:19 PM, Benoist Laurent said:

>My first observation was that the mouseMoved: method is never called.

There's your problem. :)

>It's quite interesting because the OnMouseMove methode of my
>InteractorStyle is called when you move the mouse AND click in the same time
>but the mouseMoved method of the vtkCocoaGLView like I said is never called.
>
>My vtkCocoaGLView therefore doesn't handle the device events.
>Wrong.
>The same "print Hello" in the keyUp method works well (idem for the
>other events).
>So every event works except the mouseMove event ?!!
>
>After a more specific search, a interesting link was found which explain
>that mouse move events are deactivated by default in Cocoa (in a
>performance matter).
>  http://serenity.uncc.edu/web/ADC/2005/Developer_DVD_Series/April/ADC
>%20Reference%20Library/documentation/Cocoa/Conceptual/BasicEventHandling/
>Tasks/HandlingMouseEvents.html
>
>The answer is :
>  [window setAcceptsMouseMovedEvents:YES];
>
>It's that simple but I've not see it elsewhere before.

If you look at the VTK code, you'll see:

- (void)mouseMoved:(NSEvent *)theEvent
{
  // Note: this method will only be called if this view's NSWindow
  // is set to receive mouse moved events.  See setAcceptsMouseMovedEvents:
  // An NSWindow created by vtk automatically does accept such events.

Are you creating the NSWindow or is VTK?

-- 
____________________________________________________________
Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada





More information about the vtkusers mailing list