GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Function to disable all locked tabs for a single session

feature-request

#1

I’m using lots of linked files, most of them being locked. But sometimes it would be very handy, if we could toggle all locked states to “no lock” temporarily. I know, that we already have commands to change the lock states. So basically i am requesting a mode to remove the locks generally, without having to use the keyboard command for maybe four tabs (two linked pairs of tabs) one by one.

When i restart my standard lister, all would be reset through Go Tabgroupload to normal.


#2

This button will unlock all tabs in the current lister:

Unlock All Tabs.dcf (4.0 KB)

Script code for reference:

function OnClick(clickData)
{
	var cmd = clickData.func.command;
	cmd.deselect = false;
	cmd.ClearFiles();

	var rightActive = clickData.func.sourcetab.right;
	var leftTabIndex = -1;
	var rightTabIndex = -1;

	var tabIndex = 0;
	var right = false;
	for (var eTab = new Enumerator(clickData.func.sourcetab.lister.tabs); !eTab.atEnd(); eTab.moveNext())
	{
		var tab = eTab.item();
		if (!right && tab.right)
		{
			right = true;
			tabIndex = 0;
		}

		if (tab.visible)
		{
			if (tab.right)
			{
				rightTabIndex = tabIndex;
				break;
			}
			else
			{
				leftTabIndex = tabIndex;
			}
		}

		++tabIndex;
	}

	tabIndex = 0;
	right = false;
	cmd.RunCommand("Set SOURCE=left");
	for (var eTab = new Enumerator(clickData.func.sourcetab.lister.tabs); !eTab.atEnd(); eTab.moveNext())
	{
		var tab = eTab.item();
		if (!right && tab.right)
		{
			right = true;
			tabIndex = 0;
			cmd.RunCommand("Set SOURCE=right");
		}
		if (tab.lock != "off")
		{
			cmd.SetSourceTab(tab);
			cmd.RunCommand("Go TABSELECT=" + tabIndex);
			cmd.RunCommand("Go TABLOCK=off");
		}
		++tabIndex;
	}	

	if (rightActive && leftTabIndex != -1)
	{
		cmd.RunCommand("Set SOURCE=left");
		cmd.RunCommand("Go TABSELECT=" + leftTabIndex);
	}

	if (rightTabIndex != -1)
	{
		cmd.RunCommand("Set SOURCE=right");
		cmd.RunCommand("Go TABSELECT=" + rightTabIndex);
	}

	if (!rightActive && leftTabIndex != -1)
	{
		cmd.RunCommand("Set SOURCE=left");
		cmd.RunCommand("Go TABSELECT=" + leftTabIndex);
	}
}

#3

Thanks a lot, Leo. I just tested the button, it works perfectly!