[vtkusers] Customized interaction in Tk

Roger Blum roger_blum at swissonline.ch
Tue Nov 15 05:03:53 EST 2005


Hello vtk users,

I am customizing the interaction with vtk (5.0) for my tcl/tk application.

I use a vtkTkRenderWidget to display the data.

I have created a couple of interactor styles
  set style1 [vtkInteractorStyleImage style1]
  set style2 [vtkInteractorStyleRubberBandZoom style2]
  ...

I configure these styles with
  $style1 AddObserver LeftButtonPressEvent cbOnLBP1
  $style1 AddObserver LeftButtonReleaseEvent cbOnLBR1
  $style1 AddObserver MouseMoveEvent cbOnMM1

  $style2 AddObserver LeftButtonPressEvent cbOnLBP2
  $style2 AddObserver LeftButtonReleaseEvent cbOnLBR2
  $style2 AddObserver MouseMoveEvent cbOnMM2

where cbXYZ are callback procedures

Now I would like to switch between these interactor styles:
  set iren [[$renWin GetRenderer] GetInteractor]
  $iren SetInteractorStyle $style1
or
  $iren SetInteractorStyle $style2

But this doesn't seem to work, as I loose the basic behavior
of the interactor styles (e.g. the interactor style RubberBandZoom
doesn't show the rubber band and doesn't zoom anymore).

Do I have to add some method calls?
What do I have to take care of in the callback routines?
Are there any sample of customized interaction with
vtkTkRenderWidget?

Thanks for your help,
Roger






More information about the vtkusers mailing list