Small feature request: option 'both' for Set Gridlinesh=toggle

I'd like to suggest this option:

Set Gridlinesh=toggle,both

1 Like

To toggle horizontal and vertical lines at once? Or something else?

In my case, only the horizontal ones. But it would make sense to have it for vertical as well, i suppose.

But what do you want the "both" part to do? You didn't say. :slight_smile:

Well, if i use the command, and i forgot so say i was talking about the alternating pattern, i would prefer to have the grid toggled on either side of the lister, in both file displays. At the moment it only will work at the current side.

Ah, that makes sense! Thanks for explaining it.

Here's a button that will toggle horizontal lines in all tabs of the active window.

Only caveat is it won't affect new tabs -- those will still get the main Preferences setting. (Affecting new tabs would probably be better done via a command to change the Preferences option itself, instead of just overriding it for a single tab. We could add that but don't have it at the moment. It could also be done via a script add-in, but writing that is much more complicated than the quick script below.)

For reference, it runs this script code:

// Toggles horizontal grid lines in all tabs in the active window.
// Chooses what to do based on the source tab's state.
// Other tabs (if any) could be out of sync before should be in sync after.
// Does not affect new tabs or other windows; change Preferences for that.
// (Or a script add-in could apply the override when new windows and tabs open.)
function OnClick(clickData)
{
	var tab = clickData.func.sourcetab;
	var lister = tab.lister;
	var cmd = clickData.func.command;
	cmd.deselect = false; // Prevent automatic deselection
	cmd.ClearFiles();

	var cmdLine = "Set GRIDLINESH=";
	if (cmd.IsSet("GRIDLINESH=toggle"))
		cmdLine += "off";
	else
		cmdLine += "on";

	for (var eTab = new Enumerator(lister.tabs); !eTab.atEnd(); eTab.moveNext())
	{
		cmd.SetSourceTab(eTab.item());
		cmd.RunCommand(cmdLine);
	}
}
1 Like

Support++ the OP's request for the option:

Set Gridlinesh=toggle,both

1 Like

Thanks Leo,jinsight,both

:slightly_smiling_face:

Will try the script!

1 Like

Works well. I made an user command and use the Shift-Doubleclick background event to toggle the grid.

1 Like

Just another half related question. All works well, but for some reason Opus now starts with the gridlines turned on. I turned them off, saved it as the new default lister, which i also use as Opus' start mode, but the gridlines keep coming back. I only need them occasionally, so what could be possibly the reason, that they keep sticking to my default mode? :thinking:

Have you changed the default setting in Preferences?

Yes. But only after you gave me the right hint. :slightly_smiling_face:
Thanks!