#newcommand
@script JScript
// Global variables
var cmd = DOpus.Create.Command, dlg = DOpus.dlg, msg_obj;
// Button code
function OnClick(clickData)
{
// --------------------------------------------------------
DOpus.ClearOutput();
cmd.deselect = false;
// --------------------------------------------------------
var delay = dlg.GetString("",250,4,"OK|Quit","Specify double click delay in milliseconds"); // Adjust delay for your system
if (dlg.result==0) return;
var dc = false; // Used to distinguish double click from single click
var str = "Using "+delay+" ms double click delay";
// Establish a detached dialog
dlg.template = "dialog1";
dlg.detach = true;
dlg.title = "Click vs Double Click";
dlg.create;
dlg.top = true;
dlg.control("group1").label = str;
dlg.show;
sc_bg = dlg.control("static1").bg;
dc_bg = "#FFFF00";
do{
msg_obj = dlg.getmsg(); // Wait for an event
if (msg_obj==false) break;
DOpus.output("ctl = "+msg_obj.control+", event = "+msg_obj.event);
if (msg_obj.control=="static1") {
if (msg_obj.event=="dblclk") {
dlg.control("static1").bg = dc_bg;
dlg.control("group1").label = str+" (Double)";
DOpus.output(str);
dc = true;
}
else {
DOpus.delay(delay);
dlg.control("check1").value = (!dlg.control("check1").value);
dc = false;
}
}
else if ((msg_obj.control=="check1") && (dc==false)) {
dlg.control("static1").bg = sc_bg;
dlg.control("group1").label = str+" (Single)";
DOpus.output(str);
}
}
while (msg_obj);
// --------------------------------------------------------
}
==SCRIPT RESOURCES
<resources>
<resource name="dialog1" type="dialog">
<dialog fontsize="9" height="48" lang="english" width="174">
<control height="30" name="group1" title="Just Testing" type="group" width="162" x="6" y="6" />
<control halign="left" height="8" name="static1" notify="yes" title="Single or Double Click" type="static" width="150" x="12" y="18" />
<control height="10" name="check1" title="Check Box" type="check" visible="no" width="12" x="150" y="18" />
</dialog>
</resource>
</resources>