ListBox Drag and Drop?

I’m trying to implement the DnD functionality from the juce demo in my own app, but the row being dragged is not showing while I’m dragging from the listBox to the target area (Like it does in the juce demo)?? Is there something I’m forgetting, I’ve checked my code and its identical to the juce demo DnD example.? I can see the Drag and Drop works because the target area shows the row numbers that were dragged in, however the text or the rows selected are not showing under the mouse while being dragged.

Ok, i figured out why its not showing but still strange. I had the colour of my document windown set to transparentWhite, which makes the drag and drop dissapear?

HelloWorldWindow() : DocumentWindow (T("my app"), Colours::transparentWhite, DocumentWindow::allButtons,true)

actually if you set any alpha on the document colour the drag and drap dissapears. e.g

HelloWorldWindow() : DocumentWindow (T("my app"), Colours::red.withAlpha(0.7f), DocumentWindow::allButtons,true)

Also, with a ListBox is there a way to tell when a row has left the drag source region?

What component are you using as your DragAndDropContainer? If it’s a subcomponent, then the drag will only appear inside that area.

There’s no concept of a drag source region, so no. You could use a mouselistener to follow the drag though.

ok, ive just copy pasted the draganddrop demo into my app, its works exactly the same as in the juce demo, However as soon as I add one more component with any alpha element the draganddrop stops showing the drag, seems like some sort of repaint issue? If I change the position of the newly added component somewhere near the drag source it starts working, very strange!

ListBox is class is allready a mouselistener is it not(base class)? mouselistener does not seem to be responding inside ListBox , tried

[code]void mouseDrag(MouseEvent &e)
{
backcol = Colours::yellow;
repaint();
}

void mouseEnter(MouseEvent &e)
{
	backcol = Colours::blue;
	repaint();
}
void mouseExit(MouseEvent &e)
{
	backcol = Colours::red;
	repaint();
}[/code]

none of them seem to be responding, also tried setInterceptsMouseClicks(true,true); for the listbox component, but still not responding to mouse events?

What I ultimately want to do is when someone selects a row from a ListBox and starts dragging I want to be able to show my own image, or component as soon as the mouse leaves the source region, but cannot work out any alternative way, any ideas would be appreciated, mouse events are not responding if they were it would be easy to do this

I can’t really understand from that description what you’re doing… It’ll just be something silly, but you’d need to explain exactly what you’re doing with this extra component…

The listbox isn’t a single component - it contains a whole hierarchy of subcomponents, so just listening for mouse events on the top-level comp is pointless - all the interesting stuff happens to components inside it.

Not sure what the best way would be to do what you need. Maybe just making createSnapshotOfSelectedRows() virtual would be enough?