[vtkusers] MouseMoveEvent bug in Cocoa

Benoist Laurent laurentbenoist at hotmail.com
Tue Aug 18 04:01:03 EDT 2009


Yes, that was my problem.
I was aware that when VTK creates a window by its own the mouse move events where handled.
But for many reasons create it myself.

That's why I need to tell to cocoa to accept mouse move events by myself.


> From: sean at rogue-research.com
> To: laurentbenoist at hotmail.com; vtkusers at vtk.org
> Subject: Re: [vtkusers] MouseMoveEvent bug in Cocoa
> Date: Mon, 17 Aug 2009 14:45:40 -0400
> 
> 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
> 
> 

_________________________________________________________________
Téléphonez gratuitement à tous vos proches avec Windows Live Messenger  !  Téléchargez-le maintenant !
http://www.windowslive.fr/messenger/1.asp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090818/d2602a74/attachment.htm>


More information about the vtkusers mailing list