[vtkusers] Help: Interaction Using vtkRenderWindowInteractor
Wen-Hsing Chiang
wchiang at iesinet.com
Fri Sep 26 13:12:27 EDT 2003
Hum,
It is a little tricky. Here are the steps (please correct me if I am wrong):
(1) Create an instance of vtkRenderWindowInteractor, say myRenderWindowInteractor
(2) Create an instance of vtkRenderWindow, say myRenderWindow
(3) Link myRenderWindowInteractor and myRenderWindow together by
myRenderWindowInteractor->SetRenderWindow(myRenderWindow);
(4) Derive a class from one of the subclasses of vtkInteractorStyle, say myInteractorStyleClass
(5) Implement your own functions, such as OnLeftButtonDown(), in MyInteractorStyleClass.
BTW, I could not find functions such as OnLeftButtonDoubleClick().
If you really want to use double-click you could work around by
counting the time between two calls to OnLeftButtonDown(). Or you could
use the Timer of the interactor style.
Does anyone of the List have a ready-to-go implementation of OnLeftButtonDoubleClick()?
(6) Create an instance of myInteractorStyleClass, say MyInteractorStyle.
(7) Assign the interactor style to the render window interactor by
m_myRenderWindowInteractor->SetInteractorStyle(MyInteractorStyle);
Wen-Hsing Chiang
Irvine, California.
-----Original Message-----
From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] On Behalf Of #LIU QIANG#
Sent: Thursday, September 25, 2003 10:29 PM
To: vtkusers at vtk.org
Subject: [vtkusers] Help: Interaction Using vtkRenderWindowInteractor
Hi all,
I'm new to VTK. In my C++ program, I want to interact with the vtk window. I know I can use vtkRenderWindowInteractor for this purpose. But I don't know how to get the event and how to handle it.
For example, I want to get the position of the mouse, and impliment a function, A( ), when the left button double clicks the window. How can I implement this?
Thanks & Best Regards,
Qiang
+"^ئjוLbˬ*'+- ^jǤyfz ( h' ^ nnXH & " d}e
a bKh r{ r츛{m 0 d ffX)
More information about the vtkusers
mailing list