[vtkusers] Re: vtkusers Digest, Vol 31, Issue 17

Robert V Canning Robert.V.Canning at usa.dupont.com
Wed Nov 15 14:09:38 EST 2006


Thanks to Goodwin his response cleared up my understanding.



Robert V Canning wrote:
>> Hi,
>>
>>       I am trying to capture when a user presses the arrow keys.  I  am
>> using the KeyPressEvent observer to trap for key strokes but I am unable
to
>> find out how to test for the arrow keys in Tcl.   Is there anything like
a
>> constant I can use?
>>
>>       if {$keypressed == LeftArrow){
>>             dosomething {}
>>       }
>>
>> I am using VTK 5.0.2 with Tcl 8.4.13 on a Windows XP system.

Goodwin Lawlor' response  :
>Hi Bob,

>Do you mean something like:



>package require vtk
>package require vtkinteraction
>wm withdraw .
>
>vtkCubeSource cube
>
>vtkPolyDataMapper mapper
>   mapper SetInputConnection [cube GetOutputPort]
>
>vtkActor actor
>   actor SetMapper mapper
>
>vtkCamera cam
>
>vtkRenderer ren
>   ren AddActor actor
>   ren SetActiveCamera cam
>   ren ResetCamera
>
>vtkRenderWindow renwin
>   renwin AddRenderer ren
>
>vtkRenderWindowInteractor iren
>   iren SetRenderWindow renwin
>   iren AddObserver UserEvent {wm deiconify .vtkInteract}
>   iren AddObserver KeyPressEvent cbKeyPress
>   iren Initialize
>
>   proc cbKeyPress {} {
>
>     switch [iren GetKeySym] {
>       Down {cam Elevation -3; UpdateRender}
>       Up {cam Elevation 3; UpdateRender}
>       Left {cam Azimuth -3; UpdateRender}
>       Right {cam Azimuth 3; UpdateRender}
>       default {}
>     }
>   }
>
>   proc UpdateRender {} {
>     cam OrthogonalizeViewUp
>     renwin Render
>   }

This communication is for use by the intended recipient and contains
information that may be Privileged, confidential or copyrighted under
applicable law. If you are not the intended recipient, you are hereby
formally notified that any use, copying or distribution of this e-mail,
in whole or in part, is strictly prohibited. Please notify the sender by
return e-mail and delete this e-mail from your system. Unless explicitly
and conspicuously designated as "E-Contract Intended", this e-mail does
not constitute a contract offer, a contract amendment, or an acceptance
of a contract offer. This e-mail does not constitute a consent to the
use of sender's contact information for direct marketing purposes or for
transfers of data to third parties.

Francais Deutsch Italiano  Espanol  Portugues  Japanese  Chinese  Korean

           http://www.DuPont.com/corp/email_disclaimer.html



More information about the vtkusers mailing list