# TableListBox drag row based on key modifier

**URL:** <https://forum.juce.com/t/tablelistbox-drag-row-based-on-key-modifier/8153>\
**Category:** General JUCE discussion\
**Created:** [February 18, 2012, 8:22pm UTC](https://forum.juce.com/t/tablelistbox-drag-row-based-on-key-modifier/8153 "2012-02-18T20:22:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![graeme-2](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@graeme-2](https://forum.juce.com/u/graeme-2)\
**Post date:** [February 18, 2012, 8:22pm UTC](https://forum.juce.com/t/tablelistbox-drag-row-based-on-key-modifier/8153/1 "2012-02-18T20:22:09Z")

</div>

Is there a proper way to restrict a drag operation based on mouse event modifiers? I need for rows to only be draggable if the command or ctrl keys are pressed.

-startDragAndDrop cannot be overridden.  
-I have tried to use cellClicked to manage my own flag but it only happens on mouseDown when the row isn’t already selected, otherwise it happens on mouseUp which is too late to stop the drag operation.  
-getDragSourceDescription does not receive the mouse event so unable to determine the context of the operation there.

Am I missing something obvious? I’m sure I can hack it if I get hacky enough but having a proper method for doing this would be useful.

Thanks.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [February 19, 2012, 10:47am UTC](https://forum.juce.com/t/tablelistbox-drag-row-based-on-key-modifier/8153/2 "2012-02-19T10:47:43Z")

</div>

Can’t you just check ModifierKeys::getCurrentModifiers() in your getDragSourceDescription() ?

---

<div class="post-metadata">

**Author:** ![graeme-2](https://avatars.discourse-cdn.com/v4/letter/g/8baadc/32.png) [@graeme-2](https://forum.juce.com/u/graeme-2)\
**Post date:** [February 19, 2012, 7:52pm UTC](https://forum.juce.com/t/tablelistbox-drag-row-based-on-key-modifier/8153/3 "2012-02-19T19:52:44Z")

</div>

Ah yes, yes I can. Thanks!
