[vtkusers] annotatepick.tcl to annotatepick.cxx

Obada Mahdi omahdi at gmx.de
Thu Jan 19 18:00:35 EST 2006


Hi Gilbert!

On Thu, 19 Jan 2006, Gilbert Mensah wrote:
> I tried doing it but i'm having problems with how
> AddObserver works in c++,that is passing that
> annotatepick function as they did PROC annotatepick in
> tcl.Really need your help.Thanks

The AddObserver method expects a vtkCommand-compatible instance, whose
`Execute' method is invoked when the event is dispatched.  To get your own
function called, you can set up a `vtkCallbackCommand' accordingly and pass it
to `AddObserver':

|	picker = vtkCellPicker::New();
|	annotatePickCallback = vtkCallbackCommand::New();
|	annotatePickCallback->SetCallback(annotatePick);
|	annotatePickCallback->SetClientData(this);
|	picker->AddObserver(vtkCommand::EndPickEvent, annotatePickCallback);

where `annotatePickCallback' is your own function, which has to accept four
parameters, one of which is set to whatever you provided via `SetClientData'.
This mechanism is needed to pass custom data to your callback function.

> Can anyone help me convert annotatepick.tcl to
> annotatepick.cxx.

I have attached a C++ version of "annotatePick.tcl".

Feel free to contact me directly for further questions.


Regards

Obada
-------------- next part --------------
A non-text attachment was scrubbed...
Name: annotatePick.cc
Type: text/x-c++src
Size: 4831 bytes
Desc: 
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060120/31f1253b/attachment.cc>


More information about the vtkusers mailing list