# Change interactor style for a little time

**URL:** <https://discourse.slicer.org/t/change-interactor-style-for-a-little-time/24584>\
**Category:** Development\
**Created:** [July 31, 2022, 8:43pm UTC](https://discourse.slicer.org/t/change-interactor-style-for-a-little-time/24584 "2022-07-31T20:43:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [July 31, 2022, 8:43pm UTC](https://discourse.slicer.org/t/change-interactor-style-for-a-little-time/24584/1 "2022-07-31T20:43:08Z")

</div>

Hi,

I’m trying to allow [rubber band 2D](https://kitware.github.io/vtk-examples/site/Cxx/Interaction/RubberBand2D/) to change field of view of a slice node.  
Thus I change interactor style for `vtkInteractorStyleRubberBand2D` for a while and then I need to restore the default `vtkMRMLSliceViewInteractorStyle`.

The problem is that `vtkMRMLSliceViewInteractorStyle` is initialized in [qMRMLSliceViewPrivate](https://github.com/Slicer/Slicer/blob/38e026f75f78320a2cb579b5fa96f0917ab4f02c/Libs/MRML/Widgets/qMRMLSliceView.cxx#L154-L178) as `vtkNew<>` pointer so the interactor is the owner and gets some displayable managers.  
Thus it seems I cannot simply create new instance of that style and pass it to the interactor.

Can’t understand how to restore the default `vtkMRMLSliceViewInteractorStyle`. Or maybe there are other ways to implement that.

---

<div class="post-metadata">

**Author:** ![keri](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/keri/32/11618_2.png) [@keri](https://discourse.slicer.org/u/keri)\
**Post date:** [July 31, 2022, 10:00pm UTC](https://discourse.slicer.org/t/change-interactor-style-for-a-little-time/24584/2 "2022-07-31T22:00:26Z")

</div>

Oh completely forgot about `vtkWeakPointer<>`.  
It seems I’m able to store previous interactor style in weak pointer in member variable within diplayable manager.  
After changing FOV I can restore it back to the interactor.
