Show internal command changes selection

When a Show command is executed the specified item is selected and all other selected items are deselected. Is there any way to prevent this behaviour? Test button attached. Select a few files and execute to see what happens.

function OnClick(clickData)
{
	// --------------------------------------------------------
	var cmd = clickData.func.command;
	cmd.deselect = false; // Prevent automatic deselection
	// --------------------------------------------------------
	var n = clickData.func.sourcetab.selected_files.count;
	if (clickData.func.sourcetab.selected_files.count>0){
		var f = String(clickData.func.sourcetab.selected_files(0));
		cmd.RunCommand('Show "'+f+'"');
	}
	// --------------------------------------------------------
}

ShowTest.dcf (1.1 KB)

Works here without deselecting.

Maybe the viewer deselects the files on exit with a button like this

Show VIEWERCMD=selectfile
Show VIEWERCMD=close

Hmm. Just tried with a vanilla configuration and it works as expected. Now to find the culprit in my highly customised config.

Check for scripts that might be doing it.

First port of call. :grinning:

The culprit turns out to be Viewer_Select.js

Interestingly, I am developing a script that keeps track of the "current" file within a group of files using the excellent dlg.WatchTab capability which wasn't available back in 2017 when the Viewer Select script was written.

1 Like