I’ve got a TableListBox where I need to know if the selection has changed with a mouse click or via the Up/Down keys…. so I was wondering if you would consider changing (or adding):
//==============================================================================
/** Override this to be informed when rows are selected or deselected.
@see ListBox::selectedRowsChanged()
*/
virtual void selectedRowsChanged (int lastRowSelected);
to
//==============================================================================
/** Override this to be informed when rows are selected or deselected.
@see ListBox::selectedRowsChanged()
*/
virtual void selectedRowsChanged (int lastRowSelected, bool isMouseClick);
and in Listbox::selectRowInternal() change the call to:
BTW - I know we have cellClicked() but it’s called after selectedRowsChanged() - so I can do what I want using a private boolean value which I set in selectedRowsChanged() and check for in cellClicked()… but it would be cleaner with the above change.
There will be hundreds of people out there with code that would break if I changed this, so I'm not really keen to do it! Couldn't you cheat and just check whether the mouse button is down at the time when the selection happens?
Yes, obviously your suggestion would work, but like I said, it'd be a breaking change that would impact hundreds/thousands of projects, which is why I'm reluctant to do it!
Also it doesn't feel right to me for it to matter what the cause of the selection change was.. I can't really imagine a situation where I'd write code where that would be right way to do it. What's your actual use-case for this?