[vtkusers] VTKcallbackcommand passing a class function

David Doria daviddoria at gmail.com
Mon Apr 1 07:41:17 EDT 2013


Take a look at this example:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/ObserverMemberFunction

It shows how you can use a member function as an observer.

David


David


On Fri, Mar 29, 2013 at 2:38 PM, harshanand <harsha.nyshadham at gmail.com>wrote:

> Hi Guys,
>
> I am new to programming and I am not sure how to fix this.
>
> I have a class GBConnecivity and would like to setup vtkcallback to use
> function from this class.
>
> This is what I am doing:
>
> <.h>
> class GBConnectivityApp
> {
> public:
> void ClickCallbackFunction (vtkObject* caller, long unsigned int eventId,
> void* clientData, void* callData);
> }
>
> <.cpp>
> void GBConnectivityApp::ClickCallbackFunction(vtkObject*
> vtkNotUsed(caller),
> long unsigned int vtkNotUsed(eventId), void* clientData, void*
> vtkNotUsed(callData))
> {
> .................some stuff
> }
>
> I am calling it like this from another function of same
> class(GBConnectivityApp)
>
> vtkSmartPointer<vtkCallbackCommand> clickCallback =
>                 vtkSmartPointer<vtkCallbackCommand>::New();
>
>         clickCallback->SetCallback (ClickCallbackFunction );
>         ui.qvtkWidget->update();
>
> It would  not accept this, I tried GBConnectivityApp::ClickCallbackFunction
> , would not take it. I get the error missing parameters to functions. So I
> pass the parameters to cliclcallbackFunction, it would  not take it too.
>
> What am i doing wrong?
>
> Thanks for the help!!!
>
>
>
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/VTKcallbackcommand-passing-a-class-function-tp5719722.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130401/bb776b32/attachment.htm>


More information about the vtkusers mailing list