Problem using mousedown and mousedoubleclick events together


I have developed a code which reduces my document window into a system tray image, and on clicking on the maximize option of the taskbar’s menu, it macimizes/restores the application’s window. So far so good. But i also need to capture a double-click event. what happens is since i have a mouse down handler method already, wnenever i double-click on the task-bar window, the control still goes to the mouse-down handler method instead of double-click handler method. I also tried using the ‘getNumberOfClicks()’ method within the mouse-down handler method, but it still returns 1 for a double-click. Is there a way in which i can use both the mousedown and mousedoubleclick handler methods together?


The system tray stuff works differently from the normal mouse-clicking, but it should call the double click callback as well. Try tracing into the WM_TRAYNOTIFY callback in juce_win32_Windowing to see what’s going on…


I have a similar problem.
I am trying to open a notepad application from my JUCE application, when user clicks on one of the buttons.

THe problem is, when user double clicks on the button, the control first goes down to mouse down handler and then goes to mousedoubleclick handler.
Is there a way to restrict the control from going to mousedown handler and it only goes to mousedoubleclick handler.

Is there a method to read the doubleclick time (time between two mouse clicks to qualify for a double click) set in the system?


Kiran Kumar

I don’t need to change anything for you to do that, there are many ways you can handle it.

E.g. in the mouseDown, use the MouseEvent::getNumberOfClicks() value to see if it’s a double-click. Or start a timer when the button is clicked, which will perform the button’s operation in e.g. 500ms, and then cancel the timer if a double-click arrives in the meantime.

Thanks Jules.
I was trying the similar fashion, but made a simple mistake, which I could make out after seeing your message.