I’m trying to distinguish different Mouse Events for a draggable componnent :
when mouse is dragged, drag the component
when mouse is Single Clicked : open a popup window
when mouse is Double Clicked : open another popup window.
I have overriden the mouseDrag to achieve step 1.
I have overriden the MouseUp and checked for the number of clicks to track single clicks
void myDraggableComponent::mouseUp(const MouseEvent &e)
{
const int nbOfClicks = e.getNumberOfClicks();
if(nbOfClicks==1)
{
/// do thing here
}
}
i have overriden the MouseDoubleClick in order to track double cliks. But it seems i’m never going there.
it seems that what i’m doing in MouseUp prevents the MouseDoubleClick from being called.
For stuff like this I normally override mouseDown and mouseUp, and then use the MouseEvent::getNumberOfClicks() to find out what’s going on. The logic can get pretty complicated, depending on your app - maybe have a look at things like SelectedItemSet::addToSelectionOnMouseUp for inspiration.
thanks for seeing that, but it was correctly written in my code. I typed it wrong in my forum post.
After “commenting parts” of the code to see what was wrong , it looks like the popup window is resetting the MouseEvent behaviour. Ha yes : it’s a modal popupWindow shown like this :
if i remove this part and trigger another graphical event (colour change for instance), then it works and i can distinguish between double, single clicks and drag.