# How to disable double click when placing markups

**URL:** <https://discourse.slicer.org/t/how-to-disable-double-click-when-placing-markups/26045>\
**Category:** Support\
**Created:** [November 3, 2022, 9:01am UTC](https://discourse.slicer.org/t/how-to-disable-double-click-when-placing-markups/26045 "2022-11-03T09:01:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnzzll](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nnzzll/32/16350_2.png) [@nnzzll](https://discourse.slicer.org/u/nnzzll)\
**Post date:** [November 3, 2022, 9:01am UTC](https://discourse.slicer.org/t/how-to-disable-double-click-when-placing-markups/26045/1 "2022-11-03T09:01:06Z")

</div>

When placing markups consistently (check the `Place multiple control points` button), if I double clicked then it will terminate the place process. How can I avoid it?

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [November 3, 2022, 10:31am UTC](https://discourse.slicer.org/t/how-to-disable-double-click-when-placing-markups/26045/2 "2022-11-03T10:31:08Z")

</div>

> [@nnzzll](#):
>
> if I double clicked then it will terminate the place process. How can I avoid it?

Why do you need to double-click? Just curious?

---

<div class="post-metadata">

**Author:** ![nnzzll](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nnzzll/32/16350_2.png) [@nnzzll](https://discourse.slicer.org/u/nnzzll)\
**Post date:** [November 3, 2022, 11:08am UTC](https://discourse.slicer.org/t/how-to-disable-double-click-when-placing-markups/26045/3 "2022-11-03T11:08:06Z")

</div>

In fact I don’t need double-click but sometimes you may just do it accidentally, and that is how I find this problem.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [November 3, 2022, 11:18am UTC](https://discourse.slicer.org/t/how-to-disable-double-click-when-placing-markups/26045/4 "2022-11-03T11:18:16Z")

</div>

There needs to be a function to stop the placement so that, for example you can reorient your object in 3D view to get the new ones. That’s normally the right-click. I never tried double-click before, but I can confirm that it does indeed stop the placement mode. I don’t know whether its intentional, so I included @smrolfe @lassoan.

As for re-activating the placement mode, whether you stopped accidentally or intentionally, can be done via a quick keyboard shortcut CTRL+SHIFT+SPACE. See the documentation for [Markups keyboard shortcuts here](https://slicer.readthedocs.io/en/latest/user_guide/modules/markups.html#keyboard-shortcuts)

You can also define your own (provided that it does not conflict with already existing ones).

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [November 3, 2022, 7:50pm UTC](https://discourse.slicer.org/t/how-to-disable-double-click-when-placing-markups/26045/5 "2022-11-03T19:50:01Z")

</div>

> [@muratmaga](#):
>
> I never tried double-click before, but I can confirm that it does indeed stop the placement mode. I don’t know whether its intentional, so I included

Yes, in the [Markups module documentation](https://slicer.readthedocs.io/en/latest/user_guide/modules/markups.html#place-new-markups):

> 1. Left-click in a slice view or 3D view to place points.
> 2. Double-left-click or right-click to finish point placement.

Double-left-click is a thing as I believe it is a standard thing for ending for example a closed curve group of points.

---

<div class="post-metadata">

**Author:** ![nnzzll](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/nnzzll/32/16350_2.png) [@nnzzll](https://discourse.slicer.org/u/nnzzll)\
**Post date:** [November 4, 2022, 1:31am UTC](https://discourse.slicer.org/t/how-to-disable-double-click-when-placing-markups/26045/6 "2022-11-04T01:31:29Z")

</div>

@muratmaga @jamesobutler Thanks for the reply.

Since it is designed intentionally, I decided not to deal with it and found another way to solve my problem.

The solution goes like:

```auto
qvtkConnect(interactionNode, vtkMRMLInteractionNode::EndPlacementEvent, this,
                 SLOT(onEndPlacement()));

```

and in the slot function make a judgement when to reactive the placement mode.

```auto
void XXX::onEndPlacement()
{
  auto scene = qSlicerApplication::application()->mrmlScene();
  auto interactionNode = vtkMRMLInteractionNode::SafeDownCast(
      scene->GetNodeByID("vtkMRMLInteractionNodeSingleton"));
  auto selectionNode = vtkMRMLSelectionNode::SafeDownCast(
      scene->GetNodeByID("vtkMRMLSelectionNodeSingleton"));
  auto nodeID = selectionNode->GetActivePlaceNodeID();
  auto node = vtkMRMLMarkupsFiducialNode::SafeDownCast(scene->GetNodeByID(nodeID));
  if (Judgement about the MarkupsNode)
  {
    interactionNode->SetCurrentInteractionMode(vtkMRMLInteractionNode::Place);
  }
}

```

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 7, 2022, 6:58pm UTC](https://discourse.slicer.org/t/how-to-disable-double-click-when-placing-markups/26045/7 "2022-11-07T18:58:09Z")

</div>

Maybe it is a bit simpler if you customize the event mappings as shown in examples the script repository: [[1]](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#customize-keyboard-mouse-gestures-in-viewers) and [[2]](https://slicer.readthedocs.io/en/latest/developer_guide/script_repository.html#assign-custom-actions-to-markups)

For example, you can remove the double-click shortcut in the first 3D view like this:

```python
threeDViewWidget = slicer.app.layoutManager().threeDWidget(0)
markupsDisplayableManager = threeDViewWidget.threeDView().displayableManagerByClassName('vtkMRMLMarkupsDisplayableManager')
markupsDisplayNodes = slicer.util.getNodesByClass("vtkMRMLMarkupsDisplayNode")
for markupsDisplayNode in markupsDisplayNodes:
  markupsWidget = markupsDisplayableManager.GetWidget(markupsDisplayNode)
  markupsWidget.SetEventTranslation(markupsWidget.WidgetStateDefine, vtk.vtkCommand.LeftButtonDoubleClickEvent, vtk.vtkEvent.NoModifier, vtk.vtkWidgetEvent.NoEvent)

```

Similarly, you can remove double-click event processing in the camera widget to prevent double-click from maximizing/restoring the current view.
