Button to Toggle the Drives toolbar under File Displays-Border-Display

I created a button to toggle the Drives Toolbar under Prefs-File Displays-Border-Display which either deletes Drives.dop under C:\ProgramData\GPSoftware\Directory Opus\Buttons\ to remove the toolbar or pastes it back in to see the drives as shown below:

<?xml version="1.0"?>
<button backcol="none" display="both" icon_size="large" label_pos="right" textcol="none">
	<label>Drives Toggle</label>
	<tip>Drives Toggle</tip>
	<icon1>#drivebuttons</icon1>
	<function type="normal">
		<instruction>@ifexists:&quot;C:\ProgramData\GPSoftware\Directory Opus\Buttons\Drives.dop&quot;</instruction>
		<instruction>Delete &quot;C:\ProgramData\GPSoftware\Directory Opus\Buttons\Drives.dop&quot; QUIET</instruction>
		<instruction>Prefs LAYOUT=&quot;Commander JEG&quot;</instruction>
		<instruction>Close ALLOTHERLISTERS</instruction>
		<instruction>@ifexists:else</instruction>
		<instruction>Copy &quot;T:\Software\Utils\DOpus\Toolbars JEG\Drives.dop&quot; TO &quot;C:\ProgramData\GPSoftware\Directory Opus\Buttons\&quot;</instruction>
		<instruction>Prefs LAYOUT=&quot;Commander JEG&quot;</instruction>
		<instruction>Close ALLOTHERLISTERS</instruction>
	</function>
</button>

It's a kludge. Is there a more elegant way to do this? Thanks for any ideas.

There's a command to swap out the main File Display Toolbar with another one, but I don't think it currently lets you add and remove additional toolbars without replacing all of them with the new one.

That's something we should be able to add, however.

Isn't

Toolbar NAME=Drives TOGGLE

all that's needed here?

That would toggle it as a normal toolbar, but toolbars in the File Display Border (where you get a separate toolbar for each side of a dual-display window) are special.

There is a command to set which toolbar is displayed there, but it doesn't let you add/toggle multiple toolbars, just one. (I think it dates back to when you couldn't have more than one toolbar in that position.)

Thanks for the info. I look forward to a future improvement to add/toggle multiple toolbars in the File Display Border.

It turns out the Set FDBTOOLBAR command does support multiple toolbars; although it doesn't support toggle operations, you can use @if: to achieve the same effect.

@if:Set FDBTOOLBAR="File Display"
Set FDBTOOLBAR="File Display,Drives"
@if:else
Set FDBTOOLBAR="File Display"

This command will toggle between just the "File Display" toolbar and the "File Display" and "Drives" toolbars.

1 Like

Wow! That is elegant and faster than my hack version. Thank you for continuing to think about this question for two weeks plus - over holidays. Above and beyond, thank you.