The manual is definitely not describing the current reality there, you're right.
You won't get OnOpenTab for the first tab in a new lister, but you will get it for others.
You need to use OnBeforeFolderChange or OnAfterFolderChange if you want to be notified of all the paths loaded into all tabs. Those both work for the initial tab and subsequent tabs.
Here's my test:
[code]function OnInit(initData)
{
initData.name = "testopen";
initData.desc = "";
initData.copyright = "(c) 2016 Leo Davidson";
initData.version = "1.0";
initData.default_enable = true;
}
function OnOpenLister(openListerData)
{
var objlst = openListerData.lister; // newly created lister object
DOpus.output("OnOpenLister L - tab count = " + objlst.tabs.count);
for (var i = 0; i < objlst.tabs.count; ++i)
{
var objtab = objlst.tabs(i); // first tab in new lister
DOpus.output("OnOpenLister [" + i + "] - tab visible = " + objtab.visible + " tab path = " + objtab.path);
}
}
function OnOpenTab(openTabData)
{
DOpus.output("OnOpenTab - tab visible = " + openTabData.tab.visible + ", tab path = " + openTabData.tab.path);
var objlst = openTabData.tab.lister;
DOpus.output("OnOpenTab - tab count = " + objlst.tabs.count);
for (var i = 0; i < objlst.tabs.count; ++i)
{
var objtab = objlst.tabs(i); // first tab in new lister
DOpus.output("OnOpenTab [" + i + "] - tab visible = " + objtab.visible + ", tab path = " + objtab.path);
}
}
function OnBeforeFolderChange(beforeFolderChangeData)
{
DOpus.output("OnBeforeFolderChange - path = " + beforeFolderChangeData.path + ", initial = " + beforeFolderChangeData.initial);
DOpus.output("OnBeforeFolderChange - tab visible = " + beforeFolderChangeData.tab.visible + ", tab path = " + beforeFolderChangeData.tab.path);
}
function OnAfterFolderChange(afterFolderChangeData)
{
if (afterFolderChangeData.result)
{
DOpus.output("OnAfterFolderChange (read success) - tab visible = " + afterFolderChangeData.tab.visible + ", tab path = " + afterFolderChangeData.tab.path);
}
else
{
DOpus.output("OnAfterFolderChange (read failure) - path = " + afterFolderChangeData.path);
}
}[/code]
Opening a layout with tabs for C:\ D:\ E:\ produces something like this:
testopen: OnOpenLister L - tab count = 1
testopen: OnOpenLister [0] - tab visible = true tab path =
testopen: OnBeforeFolderChange - path = C:\, initial = true
testopen: OnBeforeFolderChange - tab visible = true, tab path =
testopen: OnOpenTab - tab visible = false, tab path =
testopen: OnOpenTab - tab count = 2
testopen: OnOpenTab [0] - tab visible = true, tab path = C:\
testopen: OnOpenTab [1] - tab visible = false, tab path =
testopen: OnAfterFolderChange (read success) - tab visible = true, tab path = C:\
testopen: OnBeforeFolderChange - path = D:\, initial = true
testopen: OnBeforeFolderChange - tab visible = false, tab path =
testopen: OnOpenTab - tab visible = false, tab path =
testopen: OnOpenTab - tab count = 3
testopen: OnOpenTab [0] - tab visible = true, tab path = C:\
testopen: OnAfterFolderChange (read success) - tab visible = false, tab path = D:\
testopen: OnOpenTab [1] - tab visible = false, tab path = D:\
testopen: OnOpenTab [2] - tab visible = false, tab path =
testopen: OnBeforeFolderChange - path = E:\, initial = true
testopen: OnBeforeFolderChange - tab visible = false, tab path =
testopen: OnAfterFolderChange (read success) - tab visible = false, tab path = E:\
Some of the events are running in parallel there, which confuses things. It's easier to see if I re-order things so everything that happens for each tab is grouped together:
[code]testopen: OnOpenLister L - tab count = 1
testopen: OnOpenLister [0] - tab visible = true tab path =
--- First tab (C:) ---
testopen: OnBeforeFolderChange - path = C:, initial = true
testopen: OnBeforeFolderChange - tab visible = true, tab path =
testopen: OnAfterFolderChange (read success) - tab visible = true, tab path = C:\
--- Second tab (D:) ---
testopen: OnOpenTab - tab visible = false, tab path =
testopen: OnOpenTab - tab count = 2
testopen: OnOpenTab [0] - tab visible = true, tab path = C:
testopen: OnOpenTab [1] - tab visible = false, tab path =
testopen: OnBeforeFolderChange - path = D:, initial = true
testopen: OnBeforeFolderChange - tab visible = false, tab path =
testopen: OnAfterFolderChange (read success) - tab visible = false, tab path = D:\
--- Third tab (E:) ---
testopen: OnOpenTab - tab visible = false, tab path =
testopen: OnOpenTab - tab count = 3
testopen: OnOpenTab [0] - tab visible = true, tab path = C:
testopen: OnOpenTab [1] - tab visible = false, tab path = D:
testopen: OnOpenTab [2] - tab visible = false, tab path =
testopen: OnBeforeFolderChange - path = E:, initial = true
testopen: OnBeforeFolderChange - tab visible = false, tab path =
testopen: OnAfterFolderChange (read success) - tab visible = false, tab path = E:[/code]
Maybe we need to fix the documentation and also add a new event that runs after a lister is open and all of its tabs have loaded. OnOpenLister is triggered too early if you want to work on all the tabs at once. The other events are useful if you want to do things to a single tab but things get complicated if you want to make decisions based on all the tabs.