Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TabSelect(ed) event ?

7 views
Skip to first unread message

Axel Grude

unread,
Dec 30, 2009, 10:42:26 AM12/30/09
to
Hello, a difficult question

Is there a "TabSelected" event (or something equivalent) for the tabmail
/ mailWindow? I am trying to determine the folder that was opened in
the message preview by a mail tab being selected; so far (using
SeaMonkey - Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6)
Gecko/20091206 SeaMonkey/2.0.1) I have debugged into tabMail.showTab
which appears to cause tabmail.updateCurrentTab => any events there I
could catch? When I am adding an event listener to the tabbrowser's
"select" event obviously the folder is not set yet. Or is it possible to
listen for the event in a way that my code is executed _after_ the
Mozilla code has been executed?

Maybe I am looking at the wrong DOM object, should I try to set up an
event in the foldertree container instead (There is already a
folderlistener in there but no events seem to be triggered on tab
change). Does anybody know whether the different foldertrees displayed
are the same object or separate instances for each mail tab?


any other ideas how I could get the currently selected folder URI after
another mail tab has been selected?

thanks
Axel

Andrew Sutherland

unread,
Dec 31, 2009, 4:09:43 AM12/31/09
to
On 12/30/2009 10:42 AM, Axel Grude wrote:
> Is there a "TabSelected" event (or something equivalent) for the tabmail
> / mailWindow? I am trying to determine the folder that was opened in
> the message preview by a mail tab being selected; so far (using
> SeaMonkey - Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.6)
> Gecko/20091206 SeaMonkey/2.0.1) I have debugged into tabMail.showTab
> which appears to cause tabmail.updateCurrentTab => any events there I
> could catch? When I am adding an event listener to the tabbrowser's
> "select" event obviously the folder is not set yet. Or is it possible to
> listen for the event in a way that my code is executed _after_ the
> Mozilla code has been executed?
>
> Maybe I am looking at the wrong DOM object, should I try to set up an
> event in the foldertree container instead (There is already a
> folderlistener in there but no events seem to be triggered on tab
> change). Does anybody know whether the different foldertrees displayed
> are the same object or separate instances for each mail tab?

The SeaMonkey code is relatively different from the Thunderbird code in
this scenario, as I understand it. You probably want to ask in the
SeaMonkey newsgroup.

If you are looking to accomplish the same goal in Thunderbird, if you
could elaborate more on what your use case is, that can help me target
the response. Broadly speaking for Thunderbird, you would access
gFolderDisplay (or tabInfo.folderDisplay for the tab info for a given
tab from tabmail) to get information about the folder being displayed,
and would add a listener to the folder tree to know when the selection
changes. Because we re-display the contents of the preview pane on
every tab change, code that hangs directly off the message display
notifications should just work. (At least until we fix our tab
implementation :) Check folderDisplay.js and folderPane.js to see the
relevant code and documentation. Our how-to's on DevMo may also be of use.

Andrew

Andrew Sutherland

unread,
Dec 31, 2009, 4:15:10 AM12/31/09
to
On 12/31/2009 04:09 AM, Andrew Sutherland wrote:
>> Maybe I am looking at the wrong DOM object, should I try to set up an
>> event in the foldertree container instead (There is already a
>> folderlistener in there but no events seem to be triggered on tab
>> change). Does anybody know whether the different foldertrees displayed
>> are the same object or separate instances for each mail tab?

Oh, and there's only one set of UI widgets for all of the 3-pane and
message display tabs. (One folder pane tree, one thread pane tree, one
preview pane.)

Andrew

Robert Kaiser

unread,
Dec 31, 2009, 7:00:23 AM12/31/09
to
Andrew Sutherland wrote:
> Broadly speaking for Thunderbird, you would access
> gFolderDisplay

FYI, gFolderDisplay partly works for SeaMonkey 2 as well - we
implemented parts of it as a compatibility layer until we hopefully will
be able to fully switch over in a future version.

Robert Kaiser

Axel Grude

unread,
Jan 7, 2010, 6:31:48 AM1/7/10
to
Thanks,

that's helpful information. For now, I have solved it by setting a Timer
on the select event (which is a bit of a kludge as it is triggered
before the select, but it works for SM, TB3 and Postbox), so that the
extension can query the current selected folder after the select event
is finished. Didn't find an [on]selected event anywhere...

if (QuickFolders.Util.Application()=='Postbox')
this.tabContainer =
document.getElementById('tabmail').mTabContainer;
else
this.tabContainer =
document.getElementById('tabmail').tabContainer;

this.tabContainer.addEventListener("select",
qfTabListener.mailTabSelected, false);

..

var qfTabListener = {
mailTabSelected: function(evt){
try {
if(QuickFolders)
QuickFolders.Interface.setTabSelectTimer();
}
catch(e) {qfLocalErrorLogger("Exception in Item event - calling
mailTabSelected: " + e)};
}
}


setTabSelectTimer: function() {
try {
var nDelay = 250;
var func = "QuickFolders.Interface.tabSelectUpdate()";
var tID=setTimeout(func, nDelay);
QuickFolders.Util.logDebug("Folder Tab Select Timer ID: " + tID);
}
catch (e) {
QuickFolders.Util.logDebug("setTabSelectTimer: " + e);
}
}

0 new messages