[vtkusers] vtkCallbackCommand !!

ALIZIER Julien AUSY julien.alizier-ausy at irsn.fr
Tue Jun 1 04:03:19 EDT 2004


Hi AJ,

I don't know how vtkCallbackCommand is working... 
But I can suggest to set the DoStuff function as a static member of MyClass.
I know VC++ 6 does not allow pointers to non-static C++ methods. I don't
know how gcc handle this.

HTH

-- Julien



-----Message d'origine-----
De : A J [mailto:lost_bits1110 at hotmail.com]
Envoyé : mardi 1 juin 2004 01:39
À : vtkusers at vtk.org
Objet : RE: [vtkusers] vtkCallbackCommand !!


..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/

_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list