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

Hover Help on Dynamically Generated XUL Elements

12 views
Skip to first unread message

Martin Packer, IBM

unread,
Nov 15, 2006, 6:16:17 AM11/15/06
to
For a Firefox extension of mine that I'm currently extending I generate
a tabbox with a bunch of tabs. Each associated tabpanel includes a listbox.

These are all generated using javascript using createElementNS() with
the appropriate XUL namespace as the first parameter.

Generating these works fine.

I would like to add some tooltip functionality to both the tabs and the
listbox items:

For the tabs (as I am cropping them to fit the real estate) I want to
have hover help which is actually the full version of the tab text (as
it was before it was displayed cropped).

For the listitem elements I'd like to show some additional information
relating to the listitem.

Any ideas as to how I do this for dynamically-generated elements?

Thanks, Martin

Martin Packer, IBM

Neil

unread,
Nov 15, 2006, 8:06:13 AM11/15/06
to
Martin Packer, IBM wrote:

> I would like to add some tooltip functionality to both the tabs and
> the listbox items:

The easiest way would appear to be to set appropriate tooltiptext on the
elements, although this is currently limited to one line of text.

--
Warning: May contain traces of nuts.

Martin Packer, IBM

unread,
Nov 15, 2006, 8:47:37 AM11/15/06
to
Neil wrote:
> Martin Packer, IBM wrote:
>
>> I would like to add some tooltip functionality to both the tabs and
>> the listbox items:
>
> The easiest way would appear to be to set appropriate tooltiptext on the
> elements, although this is currently limited to one line of text.
>

I tried that. Perhaps it's my incompetence but the tooltiptext never
appeared. Should I persist?

Thanks, Martin

Gijs Kruitbosch ("Hannibal")

unread,
Nov 15, 2006, 4:48:39 PM11/15/06
to

ChatZilla does a pretty similar thing (though not on a
listbox/listitems). It uses a <tooltip> element and some custom
attributes on the items, combined with a general mouseover event listener.

See:
http://lxr.mozilla.org/seamonkey/source/extensions/irc/xul/content/config.xul#66
(tooltip)
http://lxr.mozilla.org/seamonkey/source/extensions/irc/xul/content/config.js#1256
(listeners)
http://lxr.mozilla.org/seamonkey/source/extensions/irc/xul/content/config.js#693
(attribute setting)
http://lxr.mozilla.org/seamonkey/source/extensions/irc/xul/content/config.js#904
(showing/hiding the tooltip)


Hope that helps,
Gijs

Martin Packer, IBM

unread,
Nov 18, 2006, 5:38:54 AM11/18/06
to
In the end I gave up and used a status bar and a "onmouseover" event
handler to update the status bar. I placed the bar right above the line
of tabs.

As for the listitems, I'll have to use a similar technique - but perhaps
with a delay.

Martin

0 new messages