[vtkusers] vtkcommand and events

David Doria daviddoria+vtk at gmail.com
Thu Nov 19 07:47:29 EST 2009


On Thu, Nov 19, 2009 at 4:32 AM, Radu Ilinca <radu_away_hu at yahoo.com> wrote:

> To: 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.
>
>
>
Can you provide the smallest compilable example of the problem?

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


More information about the vtkusers mailing list