[vtkusers] Adding event observer to a vtkRenderWindowInteractor changing application behavior?

David Cole david.cole at kitware.com
Fri Jan 18 08:15:19 EST 2008


Is the 3rd event, by any chance, the "ExitEvent"?

If not, what are the 3 events you do receive?

What does the rest of your code in main look like? Do you have your own
event loop, or do you call Start on the RenderWindowInteractor?

Post some more info and somebody will help you get to the bottom of this...


David


On 1/17/08, Mark Waligora <mark.waligora at gmail.com> wrote:
>
> Hey all,
> I'm having a problem with setting up an event handler.  I create a class
> called UpdateCallback which inherits from vtkCommand.  I override the
> Execute function from vtkCommand.  My Execute function simply contains a
> print statement for the time being.
>
> In my main function, I create an instance of my class and add it as an
> observer to my vtkRenderWindowInteractor for the "AnyEvent" event.
>
> UpdateCallback* onUpdate = UpdateCallback::New();
> iren->AddObserver(vtkCommand::AnyEvent, onUpdate);
>
> When I do this, my program prints the statement in my Execute function 3
> times, and then exits.  If I comment out the line of code that adds my
> UpdateCallback as an observer:
>
> // iren->AddObserver(vtkCommand::AnyEvent, onUpdate);
>
> then the program runs as normal until you close it.  I've searched the
> mailing list, googled the problem, and I've read through the code in
> vtkCommand and vtkObject trying to see if adding an observer somehow changes
> the behavior of the event handling.  From what I can tell, any observer
> class should get called on the appropriate event, so adding my observer
> shouldn't create any additional side effects besides what the code in my
> observer does.  Can anyone tell me what might be going on?
>
> Thanks a bunch in advance everyone!
>
> -Mark
>
> _______________________________________________
> 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/20080118/eb7baab8/attachment.htm>


More information about the vtkusers mailing list