[vtkusers] vtkcommand and events
David Feng
dfeng at cs.unc.edu
Thu Nov 19 08:09:28 EST 2009
I suspect that you're adding the observer to the wrong class, because I
don't think renderers receive LeftButtonPressEvents. You probably want
to add your observer to the interactor style instead.
David
Radu Ilinca wrote:
> To: vtkedge at vtkedge.orgHi <mailto:vtkedge at vtkedge.orgHi> all !
>
> I am trying to catch the LeftButtonPressEvent event using the
> observer/commannd architecture. Code is pretty simmilar to the one in
> the book where it catches the StartEvent (and the code works) but i
> try the LeftButtonPressEvent. Code below:
>
> class vtkMyCallback : public vtkCommand {
> public: static vtkMyCallback *New() { return new vtkMyCallback; }
> virtual void Execute( vtkObject *caller, unsigned long, void*) {
> vtkRenderer *ren = reinterpret_cast<vtkRenderer*> (caller);
> cout << "ana are mere " << endl;
> }
> };
>
>
> ... in the main () i have:
>
> vtkMyCallback *mycallback = vtkMyCallback::New();
> ren1->AddObserver(vtkCommand::LeftButtonPressEvent, mycallback);
>
> I am using Visual Studio 2008 and WinXP
>
>
> The problem is that, I don't catch the event and actually the code
> never enters the Execute function. Could someone tell me why ?
>
> Best,
> Radu.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list