[vtkusers] vtkCallbackCommand !!

A J lost_bits1110 at hotmail.com
Mon May 31 19:39:28 EDT 2004


..BTWi'm on Linux redhat 8 using gcc

and so my compile error is

no matching function for call to `vtkCallbackCommand::SetCallback(<unknown 
type>)'
/usr/local/include/vtk/vtkCallbackCommand.h:
65: candidates are: void vtkCallbackCommand::SetCallback(void 
(*)(vtkObject*, long unsigned int, void*, void*))

but my function prototype looks like:
void DoStuff( vtkObject* , unsigned long, void* , void* );

and the definition is something like:

void MyClass::DoStuff( vtkObject* caller, unsigned long eid, void* 
clientdata, void* calldata)
{
    cout<<"event detected"<<endl;
}

and I just followed the examples I found on some posts and in some of the 
vtk pages etc and I do:
void MyClass::function()
{
        Iren->AddObserver( vtkCommand::EnterEvent , CallbackCommand );
        CallbackCommand->SetCallback(DoStuff);
}

but the compiler doesnt like that second line...
so again, any help would be really really appreciated!!!!!!!!!!!!  Sorry for 
the million posts but just wanted to clarify my problem... and hoping that 
one person at least will write back something, ..anything!  Thanks for 
bearing with me I know this must be a basic question,
Thanks in advance,
AJ



>..Or am I supposed to derive a class from vtkCommand like on page 64 of the 
>3rd edition of the VTK text book??
>
>I thought htat vtkCallbackCommand simplifies having to do all this?!
>
>
>
>>... am I supposed to include all the parameters in the DoStuff function 
>>when I do:
>>
>>CallbackCommand->SetCallback(DoStuff);
>>
>>??
>>Anywyas I tried this but I must be putting in the wrong parameters because 
>>it still wont accept it..
>>but from all the examples i've seen so far, what I have should work!! but 
>>it doesnt..!!!
>>It must be something really basic which I am not seeing, so if someone 
>>could point this out then that woudl be great and then i can finally move 
>>on
>>thank you again!!
>>
>>
>>
>>>Hi, why do I get the following compile error?? I have the correct 
>>>parameters in the function taken in by SetCallback..? So why doenst it 
>>>seem to recognize it??
>>>
>>>no matching function for call to `vtkCallbackCommand::   
>>>SetCallback(<unknown type>)'
>>>/usr/local/include/vtk/vtkCallbackCommand.h:65: candidates are:
>>>void vtkCallbackCommand::SetCallback(void (*)(vtkObject*, long unsigned 
>>>int, void*, void*))
>>>
>>>I have a class, say MyClass, and I have the following:
>>>
>>>void MyClass::function()
>>>{
>>>        Iren->AddObserver( vtkCommand::EnterEvent , CallbackCommand );
>>>	CallbackCommand->SetCallback(DoStuff);
>>>}
>>>
>>>void MyClass::DoStuff( vtkObject* caller, long unsigned int a, void* arg, 
>>>void* b)
>>>{
>>>    cout<<"detected event"<<endl;
>>>}
>>>
>>>
>>>void MyClass::Anotherfunction()
>>>{
>>>   while(1) Iren->Render();
>>>}

_________________________________________________________________
Get 200+ ad-free, high-fidelity stations and LIVE Major League Baseball 
Gameday Audio! http://radio.msn.click-url.com/go/onm00200491ave/direct/01/




More information about the vtkusers mailing list