[vtkusers] Calling a custom function when terminating vtkRenderWindowInteractor

Phil Goddard philgoddard at telus.net
Tue Aug 12 15:47:29 EDT 2008


David,
 
thanks.
I do have this working now by adding an appropriate observer.
 
Doing a Start was causing my app to crash and I haven't spent the time to
figure out why.
 
regards
Phil


  _____  

From: David Cole [mailto:david.cole at kitware.com] 
Sent: August 12, 2008 10:25 AM
To: Phil Goddard
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Calling a custom function when terminating
vtkRenderWindowInteractor


If your intent is simply to receive the 'q' or 'e' keypress events, you can
simply use AddObserver to listen for KeyPressEvent, CharEvent or
KeyReleaseEvent directly from the vtkRenderWindowInteractor.


A Win32 vtkRenderWindowInteractor will only call PostQuitMessage and
actually pop out of its own internal message loop if one was started by
calling the Start() method.

If you are running inproc as a dll (as I think you are from your other
postings) then you are probably not calling Start() and are probably relying
on your containing application's Windows message loop... So you would need
to intercept the keystrokes and do whatever is appropriate to quit your
containing app.

Does this help?


Hope so,
David


On Sat, Aug 9, 2008 at 2:21 AM, Phil Goddard <philgoddard at telus.net> wrote:




I'm wondering if someone can explain to me how to call my own custom
function when q or e is pressed on a vtkRenderWindowInteractor.

The doc for vtkRenderWindowInteractor::TerminateApp says
"This function is called on 'q','e' keypress if exitmethod is not specified
and should be overridden by platform dependent subclasses to provide a
termination procedure if one is required."

However there is no mention (that I can see) of how to specify an
exitmethod.

>From searching old mailing-list messages it seems that there used to be a
SetExitMethod method that took a pointer to a function in earlier versions,
but it doesn't seem to exist any more.

Can anyone shed some light on how I might go about this?

I tried safedowncasting my interactor to a vtkWin32renderWindowInteractor
and using its SetClassExitMethod however that seemed to have no effect.

Thanks
Phil.


_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080812/cb0b3f12/attachment.htm>


More information about the vtkusers mailing list