Right now, there’s only TreeViewItem::itemClicked(). Would it be possible to enhance this so it would contain: itemMouseDown(), itemMouseUp() ?
I tried all sorts of stuff using a MouseListener but it crashes, my code was like this:
class MyTreeViewItem:public TreeViewItem, public MouseListener
void itemClicked(const MouseEvent &e)
void mouseUp(const MouseEvent &e)
… and somehow, when I drag’n’drop the TreeViewItem onto another DragAndDropTarget, then I get a crash (access violation) in Component::MouseListenerList::sendMouseEvent() after releasing the mouse button, in this line:
Maybe there’s another, simple solution? Thanks for help.
I’m going to add a comment in the TreeViewItem code saying “No, I will not be adding any more f**king callbacks to this class!” as I’m getting tired of answering this same kind of request!
If I added itemMouseUp, then people would ask for imageMouseWheel… then itemKeyDown, etc. etc and eventually it’d end up as big as the component class. If you need fancy behaviours, you should use TreeViewItem::createItemComponent().
I know there’s createItemComponent(), I just didn’t want to create 1 Component per Item, because this could generate thousands of Components. I don’t think it would make the TreeView as responsive. I just wanted a mouseUp notification, because when the Item is clicked, it should start playing audio, and when mouse is released it should just stop audio.
It’ll only create components for the on-screen items in the tree (unless I’ve mis-remembered how it works…)