Locking folder format in "Tab Groups"

Hi,

I have custom formats set on some folders which are saved in a multi-pane Tab Group.

When I initially open the Tab Group, the folder formats are set perfectly, but the moment I navigate, the default format is applied.

How can I lock the folder format (equivalent to hitting the lock icon in the bottom right corner) in Tab Groups, so they don't reset immediately?

There are no other folder formats which apply to the folders which the tab group refers to. I don't want to create general format rules, since the specific format I want is only relevant to a certain task (which is what makes Tab Groups so useful). I just need the ability for a Tab Group to engage the "format lock" when it is selected.

Is this possible?

I could even engage the lock via script if there was a 'post tab group opened' event.

Many thanks

1 Like

The easiest way is to use a Style to open the tab group, since that can also turn on the format lock. It can use your existing group.

Thanks for the hint. I'll give that a go.

Ok, Here's what I've found.

Creating a style and selecting my Tab Group will correctly set up the lister the way I want, but with "Format Lock" disabled (same as opening a lister, and selecting the tab group).

Modifying the style to enable 'Format Lock' (tick checkbox and select 'on') changes the behaviour somewhat.

The lister now opens the Tab Group as expected, with the Format Lock padlock closed, but the Tab Group styles are no longer applied.

It appears the folder formats are locked before the tab group formats are applied.

Am I doing it wrong?

Confirmed. That may be a bug, although we need to look at the code and changelog in more detail, as I know we've modified the order the format lock gets applied in the past, and I may be forgetting the situations where you want the opposite.

We haven't had a chance to look in detail yet.

As a temporary workaround, if you turn off the format lock in the style again, you could then use a script to turn on the format lock any time that style is loaded:

Style Format Lock.js.txt (847 Bytes)

function OnInit(initData)
{
	initData.name = "Style Format Lock";
	initData.version = "1.0";
	initData.copyright = "(c) 2022 Leo Davidson";
	initData.url = "https://resource.dopus.com/t/locking-folder-format-in-tab-groups/41011/";
	initData.desc = "Turn on the format lock when a specific style is loaded";
	initData.default_enable = true;
	initData.min_version = "12.0";
}

function OnStyleSelected(styleSelectedData)
{
	if (styleSelectedData.style == "Test")
	{
	    var cmd = DOpus.Create.Command;
	    cmd.deselect = false;

		// Only really need to do this for one tab on each side, but this is one way to do that.
		for (var eTabs = new Enumerator(styleSelectedData.lister.tabs); !eTabs.atEnd(); eTabs.moveNext())
		{
      		cmd.SetSourceTab(eTabs.item());
      		cmd.RunCommand("Set FORMATLOCK=on");
		}
	}
}

Edit the if (styleSelectedData.style == "Test") line to match your style name.

1 Like

This works a treat! Thank you

1 Like

Just to follow-up on this, you shouldn't need the script/workaround anymore with 12.28 or above.

1 Like