Toggle active pane

Leo helped me with a button to do exactly this. It's a Javascript that switches between dual and single pane and (approximately) goes between half or double size as appropriate. Just repeatedly click it to switch between a double-sized single pane or two half-sized dual panes. I use it all the time.

There's commented code to affect the height, but I work with left-right panes, so I commented those out. Change as appropriate for your needs. Button's .dcf file attached for your convenience.

function OnClick(clickData)
{
	var cmd = clickData.func.command; // Get the command object

	// Grab a copy of the lister that was most recently active

	var myLister =      DOpus.Listers.LastActive()

	// Get the current geometry of the lister window

	var currentTop =    myLister.top;
	var currentBottom = myLister.bottom;
	var currentLeft =   myLister.left;
	var currentRight =  myLister.right;
	var currentWidth =  currentRight - currentLeft;
	var currentHeight = currentBottom - currentTop;
	var myNewWidth =    currentWidth;   // In case we don't want to change the width
	var myNewHeight =   currentHeight;   // In case we don't want to change the height
//	var viewMode =      "list"; // Set view mode to list
	var dualMode;

	if (myLister.dual) // Is our lister in dual mode?
	{
		// Yes - Lister is already in dual pane mode
		myNewWidth = currentWidth / 2;  // Halve the width
//		myNewHeight = currentHeight / 2;   // Halve the height
		dualMode = "Off,Right";   // Turn off dual pane mode to put it into single pane
	}
	else
	{
		// No - Lister is single pane mode
		myNewWidth = currentWidth * 2;   // Double the width
//		myNewHeight = currentHeight * 2;   // Double the height
		dualMode = "Toggle,Vert,Remember";   // Turn on dual pane mode vertical and remember the path of right pane
	}
	cmd.RunCommand("Set LISTERSIZE=" + myNewWidth + "," + myNewHeight);   // Resize the lister
	cmd.RunCommand("Set DUAL=" + dualMode);   // Set dual pane or single pane mode
//	cmd.RunCommand("Set VIEW=" + viewMode);   // Set view mode to details
}

Dual Toggler.dcf (2.9 KB)

(Updated to fix typos in comments. No code changed.)

How to use buttons and scripts from this forum - Buttons/Scripts - Directory Opus Resource Centre (dopus.com)