I have a toolbar that has a couple buttons that must handle the click and
double click events differently. In other words the command handling logic
is different for a click event and double click event. The problem is that
when I do a double click I still get the single click event. I have tried
impleming the setTimeout function but that does not work at all. Does
anybody have a idea on how to handle these two events and not both at the
same time.
I have been playing around with the following in each event handler
// Click event
globaldoubleClick=false;
window.setTimeout(function(){doSomething();}, 300);
if(globaldoubleClick)
return;
HandleSingleClickLogic();
//Dblclick
globaldoubleClick=true;
Thanks,
Tom
>// Click event
>globaldoubleClick=false;
>window.setTimeout(function(){doSomething();}, 300);
>if(globaldoubleClick)
> return;
>HandleSingleClickLogic();
>
>//Dblclick
>globaldoubleClick=true;
>
>
Your code does almost implement one way of working around your problem,
but you need a couple of tweaks:
function onClick() {
globaldoubleClick = false;
window.setTimeout(function(){doSomething();}, 300);
}
function doSomething() { // XXX need to rename this
if (globaldoubleClick)
return;
HandleSingleClickLogic();
}
function onDoubleClick() {
globaldoubleClick = true;
HandleDoubleClickLogic();
}
--
Warning: May contain traces of nuts.
<popupset id="mainPopupSet">
<!-- Right-click menu for toolbar item -->
<popup id="Button_context_menu">
<menuitem id="someIDagain"
label="Label"
oncommand="RightClickFunction();" />
</popup>
</popupset>
<toolbarpalette id="someID">
<toolbarbutton id="something"
label="Button"
class="toolbarbutton-1"
context="Button_context_menu"
oncommand="LeftClickFuction();" />
</toolbarpalette>
I figured it out.
"Neil" <ne...@parkwaycc.co.uk> wrote in message
news:l4qdnQ6u1YEWJNzW...@mozilla.org...