Hi, I implemented both UltraGrid _ClickCell() and _DoubleClickCell() event handlers. However when I double-clicked the cell or the row, _ClickCell always intercepted the event and fired, and _DoubleClickCell never fired. I am using 2008 Version 3 UltraWinGrid.UltraGrid control. I would like to have the _ClickCell event handler fired when the cell is clicked, and _DoubleClickCell event handler fired when the cell is double-clicked. I believe something needed to allow the Control to distinguish a single click from a double.
Marcell Kehmstedt said:But why doesn't the control wait to fire the click event in order to be sure that there won't occur a second click which would cause a doubleclick event?!
No control does this. It would result in a very sluggish and unresponsive UI, because there would be a delay every time you clicked something.
IF you wanted to implement this yourself, you could do it using the MouseDown event. In MouseDown, you could start a timer. Then - one of two things would happen - either the Timer_Tick event would fire, meaning that the user did not click a second time and you would response as though to a click. If the DoubleClick event fired, then you would stop the timer and handle a double-click.
But that would be a very strange UI. I know of no application that does this.
Ok, that's obvious.
But why doesn't the control wait to fire the click event in order to be sure that there won't occur a second click which would cause a doubleclick event?!
To make this pointclear: It is not possible to react on click and on doubleclick events together with the same control at a time, right?
I would prefer an option to choose the desired behaviour depending on the current use case.
Since a double click is two clicks, Click will always fire before DoubleClick. It's the same for any control.
The control cannot see the future, so when it gets a click message, it does not know that there will be a second click coming or not. :)