[vtkusers] vtkDebugMacro & vtkErrorMacro window in VC++

Andy Cedilnik Andy.Cedilnik at kitware.com
Fri Jan 4 07:44:36 EST 2002


This is from my head, so it may be wrong:

void ReportError(vtkObject *object, void *clientdata, void *calldata)
{
         // Do something (this is your callback)
}

vtkXYObject *problem = vtkXYObject::New(); // This is the object that
         // envokes error
...
...
vtkCallbackCommand *clb = vtkCallbackCommand::New();
clb->SetCallback(ReportError);
clb->SetClientData( whatever ); // This whatever is some information that 
you want to
                                        // pass in the callback for example 
pointer to your
                                        // application

problem->AddObserver( vtkCommand::ErrorEvent, clb );

So, this will now in case of error call ReportError( ) with arguments:
object - object that invoked the error
clientdata - your custom pointer set when creating command
calldata - string casted into void* whith the error

I hope this does it.

                                 Andy



At 10:23 AM 1/4/2002 +0100, Steve Boyd wrote:
>Do you know an example in the VTK code of creating an observer
>vtkCommand::WarningEvent, etc.?  I know exactly which object is
>reporting the errors, so I think I'll try that suggestion.  Thanks for
>the e-mail.





More information about the vtkusers mailing list