[vtkusers] About Mouse Move event in vtk

kang jin corkang at yahoo.com
Wed May 9 12:19:13 EDT 2007


Dear all.
I tried that capture the position of mouse during move the mouse left button in MFC application.
But I cannot get values the position of mouse ,because in vtkCommand,there is only 
vtkCommand::MouseMoveEvent.
This event correspound to all mouse move events, namely  LButton,MButton and RButon,etc.
How can I  get  the  position during  move the mouse left  button.
In my vc++ program code, part of mouse event as follow.

RMouseCommand=vtkCallbackCommand::New();
RMouseCommand->SetClientData(this);
RMouseCommand->SetCallback(RButtonPressMouseEvents);
istyle->AddObserver(vtkCommand::MouseMoveEvent,RMouseCommand);

void CDicomViewerDlg::RButtonPressMouseEvents(vtkObject* caller, unsigned long event, void* clientdata, void* callData)
{
CDicomViewerDlg* self = reinterpret_cast< CDicomViewerDlg*>( clientdata );

int x,y; 
switch(event)
{
case vtkCommand::MouseMoveEvent:
vtkInteractorStyle * istyle = vtkInteractorStyle::SafeDownCast(caller);
vtkRenderWindowInteractor * iren = istyle->GetInteractor();
int * pos = iren->GetEventPosition(); 
x=pos[0];y=pos[1];
if(y >(self->FrameHeight/2))
{
self->scaleFactor1=self->scaleFactor1*1.05;
self->scaleFactor2=self->scaleFactor2*1.05;
self->ImageReslice->SetOutputSpacing(self->scaleFactor1,self->scaleFactor2,1.0);
self->renWin->Render();
} else {
self->scaleFactor1=self->scaleFactor1/1.05;
self->scaleFactor2=self->scaleFactor2/1.05;
self->ImageReslice->SetOutputSpacing(self->scaleFactor1,self->scaleFactor2,1.0);
self->renWin->Render();
}
break;
}
}

Above code part pass to all mouse move event.
I want to process only   mouse's left button moveing event .
Who can tell me?
Thanks a lot!


 
____________________________________________________________________________________
Don't get soaked.  Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070509/479c8a41/attachment.htm>


More information about the vtkusers mailing list