I encountered a problem. I used the vtkDistanceWidget. I found that when two instances appear in the window, if there is no problem with clicking the second instance and blank, the events of both instances can be triggered. But when I click the first instance, it only triggers the events of the first instance. I don’t know why the events of the second instance are not triggered.
void vtkDistanceWidget1::AddPointAction(vtkAbstractWidget* w)
if (state == vtkDistanceRepresentation::Outside)
{
cout << "Outside" << endl;
self->CurrentHandle = -1;
return;
}
self->GrabFocus(self->EventCallbackCommand);
if (state == vtkDistanceRepresentation::NearP1)
{
cout << "NearP1" << endl;
self->CurrentHandle = 0;
}
else if (state == vtkDistanceRepresentation::NearP2)
{
cout << "NearP2" << endl;
self->CurrentHandle = 1;
}
I use these codes to locate this problem