[vtkusers] MouseMoveEvent bug in Cocoa

Benoist Laurent laurentbenoist at hotmail.com
Wed Aug 5 10:39:56 EDT 2009


Hi,

Thank you for your answer.
I don't think that's important but actually I'm using a personnal class which inherits from vtkInteractorStyleTrackballCamera.
I don't know if I need to do something special in the constructor of this class.
For the moment, I just initialize the class member variables.

So to answer your question, I tried to making my InteractorStyle inheriting from another InteractorStyle without being successfull.
If you have any idea I take it !.


BL.






> From: sean at rogue-research.com
> To: laurentbenoist at hotmail.com; vtkusers at vtk.org
> Subject: Re: [vtkusers] MouseMoveEvent bug in Cocoa
> Date: Tue, 4 Aug 2009 15:53:53 -0400
> 
> On 7/23/09 9:01 AM, Benoist Laurent said:
> 
> >I'm going crazy since a few weeks with the MouseMoveEvent.
> >Originally, I wanted to display a VTK view in a Cocoa Window.
> >I've already posted a message on vtkusers because I hadn't a real time
> >access to the mouse position : the OnMouseMove() function was called on
> >a drag movement and not every time the mouse moves.
> >I've just found why : it seems that integration of the VTK view in the
> >Cocoa window doesn't work as well as expected.
> >
> >To perform a good integration, I call the two functions SetWindowId()
> >and SetDisplayId(), as recommanded by VTK.
> 
> That's correct.
> 
> >This generates 2 warning messages "invalid drawable" at the beginning of
> >the program but the program is still running and, except the problem of
> >mouse position,
> >everything run as expected.
> 
> The "invalid drawable" message is harmless.
> 
> >If I don't call these functions, then the VTK view appears in a
> >separated window.
> 
> That's expected.
> 
> >There is no more warning message and I've a real time access to the
> >mouse position.
> >
> >Below the code of initialisation of the VTK view window, written in
> >Objective-C++ (optimal with Cocoa).
> >
> >- (id) initWithFrame:(NSRect) frame {
> >    self = [super initWithFrame:frame];
> >    if (self) {
> >        renderer = vtkRenderer::New();
> >        rendererWindow = vtkCocoaRenderWindow::New();
> >        renWinInt = vtkCocoaRenderWindowInteractor::New();
> >        vtkSmartPointer <vtkInteractorStyleSwitch> intStyle =
> >vtkSmartPointer<vtkInteractorStyleSwitch>::New();
> >
> >        intStyle -> SetCurrentStyleToTrackballCamera();
> >        renWinInt -> SetInteractorStyle(intStyle);
> >        
> >        rendererWindow -> SetWindowId([self window]);
> >        rendererWindow -> SetDisplayId(self);
> >        rendererWindow -> AddRenderer(renderer);
> >        renWinInt -> SetRenderWindow(rendererWindow);
> >        renWinInt -> CreateRepeatingTimer (1);
> >
> >        [self setVTKRenderWindow:rendererWindow];
> >        
> >        if (!renWinInt -> GetInitialized()) renWinInt -> Initialize();
> >    }
> >    return self;
> >}
> 
> That looks basically right.  Do you have the same problem with different
> interactor styles?
> 
> -- 
> ____________________________________________________________
> 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/20090805/0415137f/attachment.htm>


More information about the vtkusers mailing list