TableListBoxModel single click event



TableListBoxModel has two function for getting the mouse click events one for click and second one for doubleClick.

virtual void cellClicked (int rowNumber, int columnId, const MouseEvent& e);
virtual void cellDoubleClicked (int rowNumber, int columnId, const MouseEvent& e);

When I make a single click on any cell in the table then in that case i get a call in the cellClicked method. But when I make a double click on any cell then also I get call in the cellClicked method instead of cellDoubleClicked.

Also in both the methods when I am counting the number of click I’m getting 1 for both single click or for double click.

I am not getting the exact way to handle this. Any guideline for achieving this will be greatly appreciated and helpful to me!



Well, that’s how I’d expect it to behave - each time you get a click, it calls cellClicked(), and if two clicks happen together, it also calls cellDoubleClicked().

If you want something that will only happen on a single and not a double click, the only way to do it is to start a timer on the click, which will perform the action after e.g. 3-400 milliseconds, unless a double-click happens in the meantime and cancels the timer. I didn’t want to add that kind of behaviour the default because it’d make normal click responses very laggy, and for most people isn’t necessary.


Thanks for your great explanation sir!