<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi,<br><br>I'm going crazy since a few weeks with the MouseMoveEvent.<br>Originally, I wanted to display a VTK view in a Cocoa Window.<br>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.<br>I've just found why : it seems that integration of the VTK view in the Cocoa window doesn't work as well as expected.<br><br>To perform a good integration, I call the two functions SetWindowId() and SetDisplayId(), as recommanded by VTK.<br>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,<br>everything run as expected.<br><br>If I don't call these functions, then the VTK view appears in a separated window.<br>There is no more warning message and I've a real time access to the mouse position.<br><br>Below the code of initialisation of the VTK view window, written in Objective-C++ (optimal with Cocoa).<br><br>- (id) initWithFrame:(NSRect) frame {<br> self = [super initWithFrame:frame];<br> if (self) {<br> renderer = vtkRenderer::New();<br> rendererWindow = vtkCocoaRenderWindow::New();<br> renWinInt = vtkCocoaRenderWindowInteractor::New();<br> vtkSmartPointer <vtkInteractorStyleSwitch> intStyle = vtkSmartPointer<vtkInteractorStyleSwitch>::New();<br><br> intStyle -> SetCurrentStyleToTrackballCamera();<br> renWinInt -> SetInteractorStyle(intStyle);<br> <br> rendererWindow -> SetWindowId([self window]);<br> rendererWindow -> SetDisplayId(self);<br> rendererWindow -> AddRenderer(renderer);<br> renWinInt -> SetRenderWindow(rendererWindow);<br> renWinInt -> CreateRepeatingTimer (1);<br><br> [self setVTKRenderWindow:rendererWindow];<br> <br> if (!renWinInt -> GetInitialized()) renWinInt -> Initialize();<br> }<br> return self;<br>}<br><br><br>Does someone see something wrong in this code and/or have an idea to solve this problem.<br><br>Help would be appreciated.<br>Thanks in advance.<br><br>Ben.<br><br /><hr />Votre correspondant a choisi Hotmail et profite d'un stockage quasiment illimité. <a href='http://www.windowslive.fr/hotmail/default.asp' target='_new'> Créez un compte Hotmail gratuitement !</a></body>
</html>