I'm setting some tab variables and persisting them. When I do an Exit Directory Opus, their persistence is remembered but if I close the window and open it again, the persistence is lost. I want to keep this persistence regardless of how I close the window.
I do work with only one Directory Opus window. Closing the Window is more preferred approach as its quicker to close (no prompt) and should be quicker to launch as well. It appears that Exit Directory Opus does some additional treatment for tab variable persistence which is missing if I just close the window instead.
Preferences / Layouts and Styles / Default Lister:
Update Default Lister automatically when closing a Lister
Tab variables will be saved with a window or layout, but they're also inherently ephemeral, like the tabs and windows themselves. If you have state that you want to store permanently, tab variables may not be the best choice. (Depending on what the state is for, of course.)
I have that setting to on already. I am setting the locked path as a variable and it needs to be saved on per tab basis until the tab is closed (but surviving restarts). I understand that the tab objects would be recreated on subsequent launches. I see that it isn't a problem when Exit Directory Opus is used.
On second thoughts, I think its not the exit but the launch that is causing a different behaviour. When I launch after an Exit Directory Opus, i see a log Main process started. and this is what seems to be loading the tab variables. I don't see such log if I close the window and reopen it. And subsequently, those variables are lost as the tabs are created without these variables.
Additionally, I tried enabling automated shutdown, but even that doesn't restore the persisted tabs variable.
The default lister is updated on close but likely it doesn't persist the variables. It's a mystery how the green behaviour works then. It even survives persistent tab variables across Windows restart.
Can I use a run command to trigger the green behavior?
And as another test, if I close the lister (not shutting down DOpus), restart Windows and then start DOpus, the variables aren't persisted.
In summary, the tab variables are persisted only if I manually Shutdown DOpus and then start it. Closing lister or automated shutdown of DOpus doesn't persist them. How can I persist them even when closing the last lister.
Achieved with this. I wished there was a cleaner way though.
function OnCloseLister(closeListerData) {
// Don't interrupt shutdown
if (closeListerData.shutdown) {
return false;
}
// Close normally if more than 1 lister is open
if (DOpus.listers.count > 1) {
return false;
}
// Return false to interrupt the earlier close and issue correct close command
DOpus.CreateCommand.RunCommand("Close PROGRAM=onlast");
return true;
}