Drag'n'drop question


#1

In my JUCE application the user is able to perform drag’n’drop from a FileTreeComponent to a class that inherits from TableListBox.
It is further possible to drag’n’drop from the TableListBox onto another custom Component.

I don’t want the FileTreeComponent and the TableListBox to draw (semi-transparent) the item being dragged. I just want the Mouse Cursor to change. How do I do that?


#2

Yeah, you can drag and drop to anything you want if you make it a draganddroptarget.

There’s a method in there somewhere that can supply the image used when dragging, so just override that to return an empty transparent image, and that’ll get rid of it for you.


#3

Ok, for the TableListBox this is createSnapshotOfSelectedRows(). But let’s say I change this function so that it returns an empty Image, this will still not make the Mouse Cursor change. Is it possible to make the Mouse Cursor change while dragging?


#4

I never added anything to do that explicitly, because I think it looks better to use an image that gets dragged. You could set the cursor yourself though - that’s easy enough to do.


#5

It’s easy, but I don’t see any other way then changing the JUCE source code for obtaining what I want, i.e. a custom Image when dragging from a FileTreeComponent or a TableListBox.


#6

Would it be possible to add some function for ListBox / TableListBox that gives the programmer the possibility to create a custom image for dragging (the possibility not to use createSnapshotOfSelectedRows ( ) ), also being able to return 0 for no Image?

Why? Because when multiple rows are selected, the movement becomes really sluggish (even on my not so bad Centrino-based laptop) and it also becomes a big mess on the screen (imho).


#7