I'm trying to run a loop inside a loop: an @ifset: clause inside an @if: clause so I can return to the original left or right dual file list after going to a single file display.
I'm misunderstanding something because the following code (blank lines for readability) never goes to a single file display. What should the code be/what am I misunderstanding?
@toggle:disable
Set PAIREDFOLDERS=off
@if:Set FOCUS=left
@ifset:DUAL=On
Go TABGROUPSAVE="!both,!closeall,DST"
Set DUAL=toggle,vert,remember
Toolbar "Operations Left" LOADSET=replace
@ifset:else
Set DUAL=toggle,vert,remember
Go TABGROUPLOAD="DST" TABCLOSEALL
Toolbar "Default" LOADSET=replace
Set FOCUS=left
@if:else
@ifset:DUAL=On
Set DUAL=toggle,vert,remember
Go TABGROUPSAVE="!both,!closeall,DST"
Toolbar "Operations Left" LOADSET=replace
@ifset:else
Set DUAL=toggle,vert,remember
Go TABGROUPLOAD="DST" TABCLOSEALL
Toolbar "Default" LOADSET=replace
Thank you for taking the time to respond with code. You saw that I was trying to create a toggle.
Your code does toggle. It does not return to the original starting file display which was my goal with the looping business. It always ends up at the right file display.
Removing from your code @set lst:sourceWasRight={=IsChecked("Set SOURCE=right")=} =return Val("$lst:sourceWasRight") ? "Go SWAP" : "" =return Val("$lst:sourceWasRight") ? "Set SOURCE=right" : ""
does not change the results; it still toggles for me. What is it supposed to do.
The following code does return to the original file display:
@toggle:if Set Dual=off
@if:Set DUAL=on
@set lst:sourceWasLeft={=IsChecked("Set SOURCE=left")=}
Go TABGROUPSAVE="!both,!closeall,DST"
Toolbar SAVESET=quiet NAME=Temp
Set DUAL=toggle
@if:else
Set DUAL=toggle
Toolbar "Temp" LOADSET=replace
Go TABGROUPLOAD="DST" TABCLOSEALL
//=return Val("$lst:sourceWasLeft") ? "Go SWAP" : ""
=return Val("$lst:sourceWasLeft") ? "Set Focus=left" : ""
For it to return to the original file display, two thing have to be used:
a Toolbar pair has to be used, a dummy one here
saving the original tabs and recalling them. Yes, I know the "remember" argument for Set DUAL remembers the tabs but using the tab pair is necessary to get the return to the original file display.
I don't understand why these are necessary but it works to return to the original file display.
I don't get it.
It does return to its original state for me.
When the right/bottom panel is the one you keep, then the collapsed one returns on right/bottom before they get switched.
Start in the left/top panel and run your code. I bet it returns to the right side of the dual lister. The problem is Opus returns to the right file display whether you started in the left or right file display. This is a longer standing behavior. I don't know any easy way to get around it.
Look closer to the video, I do it both with top/left pane active, then with bottom/right active.
The active pane is the one with the blue location bar.
The top/left is active, I click the button and the bottom disappears. Clicking again makes the bottom reappear at the bottom.
I activate the bottom pane, then click the button. The top pane disappears, leaving the former bottom one the only visible. Clicking the button again make the bottom pane reappear with the content of the former top pane, then they are switched back to their original positions.
Is your button placed on a pane independent toolbar ? (meaning, not on the toolbar attached to the location bar)
EDIT: As a complement.
My understanding (since as stated, I did not write this button), is that that is the purpose of the first part of the button :
@toggle:if Set Dual=off
@if:Set DUAL=on
@set lst:sourceWasRight={=IsChecked("Set SOURCE=right")=}
Set DUAL=toggle,remember
Line by line
Activate toggle behavior
If we were on dual,
then stores in a lister variable (sourceWasRight) if the active pane was the right/bottom
then toggles to single, and remembers the tabs
And it's then checked on in the second part of the button code
Sets back to DUAL (toggle, remember : restores the tabs)
Then we have two evaluator tests
If the variable sourceWasRight is set, then it means right is now left (due to the behavior you describe), so it executes GO SWAP to interchange the two panes
If the variable sourceWasRight is set, it executes Set SOURCE=right to give focus/activate the right pane.