[vtkusers] Using vtkCallbackCommand inside a class

Aroosha Laghaee a.laghaee at sms.ed.ac.uk
Thu Apr 6 10:26:07 EDT 2006


Hello,

I am trying to use the vtkCallbackCommand in a c++ class. I would like 
to set the callback function to one of my class's member functions 
which is declared before the call is made, however on calling:

vtkCallbackCommand* m_Callback = vtkCallbackCommand::New();
m_Callback->SetCallback(Arm::UpdateTargetPosition);

I get the following error:

e:\myprojects\lara\arm.cpp(1075) : error C2664: 'SetCallback' : cannot 
convert parameter 1 from 'void (class vtkObject *,unsigned long,void 
*,void *)' to 'void (__cdecl *)(class vtkObject *,unsigned long,void 
*,void *)'
         None of the functions with this name in scope match the target type

I get the same error message if I say:
m_Callback->SetCallback(UpdateTargetPosition);

Here is the declaration of UpdateTargetPosition:

void Arm::UpdateTargetPosition(vtkObject* Object,unsigned long eventid,
			       void* ClientData,void* CallData)
{
     // the code for this
}

Can anyone please tell me what I am doing wrong?

Many thanks,
         Aroosha




More information about the vtkusers mailing list