Skip to content

Commit

Permalink
ENH: The interactor must be set before enabling the widget.
Browse files Browse the repository at this point in the history
When the method WidgetIsDefined() is called (ie the widget is defined
programmatically) and then the method SetEnabled is invoked, we run
into a bug, in that the internal HandleWidgets are enabled without
having their interactors set. Hence propagate the interactor from self
into the child widgets always.
  • Loading branch information
karthikkrishnan committed Jul 20, 2010
1 parent 3944661 commit d832206
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
20 changes: 10 additions & 10 deletions Widgets/vtkAngleWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -174,18 +174,18 @@ void vtkAngleWidget::SetEnabled(int enabling)
reinterpret_cast<vtkAngleRepresentation*>(this->WidgetRep)->
ArcVisibilityOn();
}
if (this->Point1Widget)
{
this->Point1Widget->SetEnabled(1);
}
if (this->CenterWidget)
{
this->CenterWidget->SetEnabled(1);
}
if (this->Point2Widget)

// The interactor must be set prior to enabling the widget.
if (this->Interactor)
{
this->Point2Widget->SetEnabled(1);
this->Point1Widget->SetInteractor(this->Interactor);
this->CenterWidget->SetInteractor(this->Interactor);
this->Point2Widget->SetInteractor(this->Interactor);
}

this->Point1Widget->SetEnabled(1);
this->CenterWidget->SetEnabled(1);
this->Point2Widget->SetEnabled(1);
}
}

Expand Down
26 changes: 12 additions & 14 deletions Widgets/vtkBiDimensionalWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,20 @@ void vtkBiDimensionalWidget::SetEnabled(int enabling)
vtkBiDimensionalRepresentation2D::SafeDownCast(this->WidgetRep)->
Line2VisibilityOn();
}
if (this->Point1Widget)
{
this->Point1Widget->SetEnabled(1);
}
if (this->Point2Widget)
{
this->Point2Widget->SetEnabled(1);
}
if (this->Point3Widget)
{
this->Point3Widget->SetEnabled(1);
}
if (this->Point4Widget)

// The interactor must be set prior to enabling the widget.
if (this->Interactor)
{
this->Point4Widget->SetEnabled(1);
this->Point1Widget->SetInteractor(this->Interactor);
this->Point2Widget->SetInteractor(this->Interactor);
this->Point3Widget->SetInteractor(this->Interactor);
this->Point4Widget->SetInteractor(this->Interactor);
}

this->Point1Widget->SetEnabled(1);
this->Point2Widget->SetEnabled(1);
this->Point3Widget->SetEnabled(1);
this->Point4Widget->SetEnabled(1);
}
}

Expand Down
7 changes: 7 additions & 0 deletions Widgets/vtkDistanceWidget.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ void vtkDistanceWidget::SetEnabled(int enabling)
}
else
{
// The interactor must be set prior to enabling the widget.
if (this->Interactor)
{
this->Point1Widget->SetInteractor(this->Interactor);
this->Point2Widget->SetInteractor(this->Interactor);
}

this->Point1Widget->SetEnabled(1);
this->Point2Widget->SetEnabled(1);
}
Expand Down

0 comments on commit d832206

Please sign in to comment.