[vtkusers] Identifying which button is pressed

Paul Albee Paul at Albee.com
Thu Jul 10 13:44:53 EDT 2003


Dean,
   Worked perfectly, thanks.

Cheers,
Paul

On Thursday, Jul 10, 2003, at 09:33 America/Detroit, 
<dean.inglis at on.aibn.com> wrote:

> Paul,
>
> Try adding this to VTK/Examples/GUI/Tcl/ImagePlaneWidget.tcl to get
> the idea on how to listen in on the button events:
>
>
> <snip>
> # Set the interactor for the widgets
> #
>
> set iact [[$render_widget GetRenderWindow] GetInteractor]
>
> set Cursoring 0
> $iact AddObserver LeftButtonPressEvent CursorOn 1.0
> $iact AddObserver LeftButtonReleaseEvent CursorOff 1.0
> planeWidgetX AddObserver StartInteractionEvent CursorListener
> planeWidgetX AddObserver EndInteractionEvent CursorListener
>
>
> planeWidgetX SetPriority 0.9
> planeWidgetX SetInteractor $iact
> planeWidgetX On
> planeWidgetY SetPriority 0.9
> planeWidgetY SetInteractor $iact
> planeWidgetY On
> planeWidgetZ SetPriority 0.9
> planeWidgetZ SetInteractor $iact
> planeWidgetZ On
>
> proc CursorOn {} {
>   global Cursoring
>   set Cursoring 1
> }
>
> proc CursorOff {} {
>   global Cursoring
>   set Cursoring 0
> }
>
> proc CursorListener {} {
>   global Cursoring
>   if { $Cursoring } {
>      ren1 SetBackground  1 0.1 0.2
>   } else {
>      ren1 SetBackground  0.1 0.1 0.2
>   }
>   ren1 Render
> }
>
> # Create an initial interesting view
> #
> <snip>
>
> regards,
> Dean
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: 
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list