Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Frederic Lamsens on May 16, 2008 05:50
open dhtmlx forum
dhtmlxfolders: onclick and ondblclick

When I enable the events "onclick" and "ondblclick" at the same time in dhtmlxfolders, the onclick-event is fired on every double-click. Is there a way to solve this?
Answer posted by Support on May 16, 2008 06:42

>>Is there a way to solve this?

Unfortunately no. The browser generates a lot of events when doubleclick occurs, and there is no way to differ real onclick event from onclick generated during doubleclick
( to make thing worse, each broser generates its own set of events in case of dbl-click )
The same actual for any dhtmlx component.

The only possible workaround - use timeout with onclick event

var ctr=null;
folders.attachEvent("onclick",function(){
    ctr = window.setTimeout(function(){
               // real onclick code
    },500)
});

folders.attachEvent("ondblclick",function(){
     window.clearTimeout(ctr);
     //real ondblclick code
});