DoubleClickData.cont vs. call

Hi there! o)

I tried to get some feedback on this on another channel, but now I need to ask right here.

  1. What's the exact difference when setting DoubleClickData.cont and .call? It's not very clear to me how they differ. From the description I get the impression they both do the same. What happened to the return value used in other event handlers, is it still ok to return "true" to stop the current doubleclick action, or has that logic been moved over to the .cont property? I'm a bit confused.

  2. When setting the .call property to false, I expect any further invokation of OnDoubleClickData() to be avoided.
    But in this test script and another one, which is to be downloaded here, it does not seem to have an effect. The confirmation dialog used, to get a chance to stop all selected files from being opened, will not appear only once, it will appear for every item again and again.

Any hints appreciated!
I accidentally opened about 240 exe files (all installation routines) at the weekend while playing with filters and selections.
I lost an hour of my life to click cancel, abort, quit, close and wait, wait, wait. So something that will never make that happen again is needed urgently. o)

[code]///////////////////////////////////////////////////////////////////////////////
function OnInit(initData) {
initData.name = "Event.DClick: Test";
initData.default_enable = true;
}
//////////////////////////////////////////////////////////////////////////////
var PROCEED=false;
var CANCEL=true;
//////////////////////////////////////////////////////////////////////////////
function OnDoubleClick(data) {
DOpus.Output("Cont: "+ data.cont);
DOpus.Output("Call: "+ data.call);

if (!data.multiple) return PROCEED;

if (ConfirmDialog(data)==CANCEL){
	DOpus.Output("OP cancelled.");
	data.cont = false;
	return CANCEL;
}

//do not come here anymore for the current operation
data.call = false;
return PROCEED;

}
//////////////////////////////////////////////////////////////////////////////
function ConfirmDialog(data) {
var stats = data.Tab.selstats;
dlg = data.tab.Dlg;
dlg.title = "Caution..";
dlg.message = "You are about to open "+stats.selitems+" selected items.\n\n"+
" Files: " + stats.selfiles+"\n"+
" Folders: " + stats.seldirs;
dlg.buttons = "Continue|Cancel";
dlg.defid = 0; //default cancel, rightmost btn
var result = dlg.Show();
if (result == 1)//continue
return PROCEED;
return CANCEL;
}
[/code]

From a quick read of the DoubleClickData docs:
[ul][li]call prevents the script being called again for the files and "any remaining files will be opened according to their default handlers."[/li]
[li]cont can be used to "abort double-click processing altogether".[/li][/ul]

From the OnDoubleClick docs:
[ul][li]The OnDoubleClick return result determines what happens to the current file.[/li][/ul]

Thanks, now let me try:
[ul]
[li] call: If set to "false", OnDoubleClick will not be called for these files, but they will be opened.[/li]
[li] cont: If set to "false", OnDoubleClick will not be called for these files and they won't be opened.[/li][/ul]
Is this correct? If yes, then setting call does not work if "false" is returned from OnDoubleClick().
So the event will be called (unexpectedly) for "further" files, which prevents the actual use-case these things were implemented for (I think?).

But.. what do you think? o)

Seems to work correctly here, with this simple test script:

[code]function OnInit(initData)
{
initData.name = "dc_test";
initData.desc = "Test";
initData.copyright = "";
initData.version = "1.0";
initData.default_enable = false;
}

function OnDoubleClick(doubleClickData)
{
DOpus.Output("---");
DOpus.Output("Mult: " + doubleClickData.multiple + ", Item: " + doubleClickData.item);
doubleClickData.call = false;
return false;
}[/code]

Testing with three text files, and pushing return, the script only outputs something for the first file and all three are launched.

(If I remove the call=false line, the same thing happens but the script outputs for all three files, as I'd also expect.)

I'm on current latest beta, and use to trigger the "open" for the selected files.
I cannot reproduce, if I run your testscript, it yields the same wrong result for me:


Does it fail for folders too?

Yep! o) But in the meantime, I got bit smarter. The problem is caused by another script that also makes use of OnDoubleClick, it's a variant of Leos PlayMusicFolder-Trick. If that script simply returns false, as shown below, setting .call=false in the "first" script does not have an effect anymore it seems. If I remove that PlayMusicFolder-Script, it works as desired, OnDoubleClick will not be invoked further.

What script actually comes first and if that's relevant is hard to tell, the output looks like the one using .call=false is the first one.
The more interesting question probably is, how is this meant to work and what's to be done to avoid two scripts influencing each other.
If .call=false is used in both, then it's like expected again, but this is hardly a solution I guess, as one OnDoubleClick-script may expect to be called as often as there are items after returning false, while another one may not. Tricky!? o)

function OnDoubleClick(data) { DOpus.Output("Just returning false.."); return false; }

Any more thoughts on this? I experienced the same issue again.

If there's an addin, that makes correct use of data.cont/call in the OnDoubleClick() event handling, another script handling data.cont/call differently will screw the first one.

Could you give a short, exact description of the problem? I'm not 100% sure of the exact details from what's in the thread.

Sure!

If there's a script (A), that returns "false" in the OnDoubleClick() event, setting data.call=false in another script (B) has no effect anymore. The OnDoubleClick() event of script (B) will be called multiple times. If script (A) is removed or disabled, script (B) works as expected again.

Ta. Not ignoring this, just not sure what should be done yet.