keyboard events
Hank Childs
childs at forum.llnl.gov
Sat Mar 4 17:41:13 EST 2000
> What is the best way to create new callbacks for keyboard events for
> those of us using C++ only (no Tcl)?
> Thanks
> Liz
Hello Liz,
Assuming your using X...
One way to do this is to take control of the callback loop yourself.
You do this by creating your own context (XtAppContext) and feeding it
into a vtkXRenderWindowInteractor.
// Standard stuff - mapper, actors, etc...
renWin = vtkRenderWindow::New();
// Create the context
XtAppContext context;
XtToolkitInitialize();
context = XtCreateApplicationContext();
// Add your own function to be called when something is entered into the
// keyboard. Name of function is GetStdin. 0 is file descriptor for
// stdin.
XtAppAddInput(context, 0, (XtPointer) XtInputReadMask,
(XtInputCallbackProc) GetStdin, NULL);
// Then create XRenderWindowInteractor
vtkXRenderWindowInteractor *iren = vtkXRenderWindowInteractor::New();
iren->SetRenderWindow(renWin);
iren->Initialize(context);
// To enter the callback loop...
iren->Start();
Then whenever someone enters something to the keyboard, you can catch it
and still be able to interact with your plot.
Hope this helps,
Hank
____________________________________________________________________________
Hank Childs
MeshTV
Lawrence Livermore National Laboratory
phone: (925) 422-4035
email: childs3 at llnl.gov
--------------------------------------------------------------------
This is the private VTK discussion list. Please keep messages on-topic.
Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at public.kitware.com>. For help, send message body containing
"info vtkusers" to the same address.
--------------------------------------------------------------------
More information about the vtkusers
mailing list