How to differ single and double clicks?

  • Thread starter Thread starter Alexander Osipov
  • Start date Start date
A

Alexander Osipov

Hi!
I've got into trouble trying to place different actons on single and double
clicks in the TreeView nodes.

Unfortunately, the TreeView control fires both Click and DoubleClick events
sequentially when the user makes double click on some node and there is now
way to say at first Click event whether it is followed by DoubleClick or
not.
Playing with Control.SetStyle method and its StandardClick and
StandardDoubleClick flags does not affect the events sequence too.

Are there any ideas how to distinguish single and double clicks occured in
WinForms for to handle them in a different fashion?

Thanks for any advice,
Alex.
 
Beyond waiting some elapsed time, not really. Single clicks are normally
reserved for actions that wouldn't otherwise affect the action behind a
double click. That means single clicks should do selection, be used in
drag-drop scenarios, etc... Double clicks on the other hand should perform
launch actions, or other actions that are expected to take modality or need
to be exclusive.

Things start to get more confusing when you allow label editing (single
click, wait, single click).

So unless the single-click action is something that won't interfere with the
double click, or the single click action can be *rolled back* in case the
double click happens, you should re-think your design.
 
Back
Top