[vtkusers] RE: How to Customize Mouse Event

Nigel Nunn nNunn at ausport.gov.au
Thu Nov 29 03:46:36 EST 2001


Hi Prateek, 
 
> Can any of you tell me that How I can customize 
> the mouse event, right know 
>  Mouse Button 1 : Rotate 
>  Mouse Button 2 : pan  
>  Mouse Button 3 : Scale 
> 
> But I want to create my own function at various 
> event like 
>  Mouse button 1 : Get Postion of button press 
>  Mouse button 2 : Color the image 
 
Below is description from vtkInteractorStyleUser (vtk version 3.2). 
This seems to relate to what you need.  However, there are options. 
What language and what OS?  For example, if using Visual C++ on 
Win32, you can intercept any mouse message and have your way with 
it (using either MFC message maps or WindowProc switch block) before 
(or instead of) passing the message through to the vtk[*]Interactor. 
NN. 
 
// .NAME vtkInteractorStyleUser - provides customizable interaction routines
// 
// .SECTION Description
// The most common way to customize user interaction is to write a subclass
// of vtkInteractorStyle: vtkInteractorStyleUser allows you to customize
// the interaction to without subclassing vtkInteractorStyle.  This is
// particularly useful for setting up custom interaction modes in
// scripting languages such as Tcl and Python.  This class allows you
// to hook into the MouseMove, ButtonPress/Release, KeyPress/Release,
// etc. events.  If you want to hook into just a single mouse button,
// but leave the interaction modes for the others unchanged, you
// must use e.g. SetMiddleButtonPressMethod() instead of the more
// general SetButtonPressMethod().




More information about the vtkusers mailing list