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

Event handlers on children of toolbarbutton

1 view
Skip to first unread message

Susan Crayne

unread,
Jan 7, 2010, 7:38:12 PM1/7/10
to
In an existing application that I'm modifying, there is a toolbarbutton that
has a click handler on it. I'd like to change that so that instead of the
handler on the toolbarbutton, there is a handler on the label element that
is the toolbarbutton element's first child. I've tried to do this, and the
label element does not receive the click event. I'd like to know if this is
possible. If it isn't, I can change the xul so that there is, instead of a
toolbarbutton, a box with explicit label and image children. Thanks.

reverendlinxu

unread,
Jan 7, 2010, 10:29:59 PM1/7/10
to
According to this:
https://developer.mozilla.org/en/XUL/label
and a couple of books I have, the label element doesn't support
onclick or related handlers.

Susan Crayne

unread,
Jan 7, 2010, 11:41:16 PM1/7/10
to
I looked at the page for which you gave a link, and it does not say that the
label element does not support onclick or related handlers -- in fact, I saw
this:

Inherited Methods
addEventListener, appendChild, blur(), click()

Is there other information that you know of that contradicts this?

Susan

"reverendlinxu" <revere...@googlemail.com> wrote in message
news:b33ce1e6-0e72-4db6...@j5g2000yqm.googlegroups.com...

Nickolay Ponomarev

unread,
Jan 8, 2010, 7:05:27 AM1/8/10
to dev-tech-xul
What you tried to do should be possible (if I read you prose correctly).

Nickolay

> _______________________________________________
> dev-tech-xul mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-xul
>

Susan Crayne

unread,
Jan 8, 2010, 8:44:04 AM1/8/10
to
Thanks -- that's very useful info.

Susan

"Nickolay Ponomarev" <asqu...@gmail.com> wrote in message
news:mailman.1634.1262952...@lists.mozilla.org...

reverendlinxu

unread,
Jan 8, 2010, 9:34:40 PM1/8/10
to
I went back and gave the label docs on the MDC page another read. You
were right/I stand corrected; the inherited ability to use handlers
are there. This bit of quick code worked on all the labels I could
think of (toolbars, forms, etc):
<label value="Test" onclick='alert("test");'/>

Would that do or is it too simple?

FWIW - I've gone through a couple of my books on XUL and all discuss
using buttons of one sort or another with handlers. None discuss
using handlers with labels or list options for handlers with labels.
Granted documentation for XUL is pretty mediocre at best, but I can
understand where the authors may be coming from on this. The
"conventional wisdom" would state that buttons are where handlers are
intended to be; labels are just just there for info purposes only.

On Jan 8, 6:44 am, "Susan Crayne" <susancra...@yahoo.com> wrote:
> Thanks -- that's very useful info.
>
> Susan
>

> "Nickolay Ponomarev" <asquee...@gmail.com> wrote in message


>
> news:mailman.1634.1262952...@lists.mozilla.org...
>
> > What you tried to do should be possible (if I read you prose correctly).
>
> > Nickolay
>

> > On Fri, Jan 8, 2010 at 7:41 AM, Susan Crayne <susancra...@yahoo.com>


> > wrote:
>
> >> I looked at the page for which you gave a link, and it does not say that
> >> the label element does not support onclick or related handlers -- in
> >> fact, I
> >> saw this:
>
> >> Inherited Methods
> >> addEventListener, appendChild, blur(), click()
>
> >> Is there other information that you know of that contradicts this?
>
> >> Susan
>

> >> "reverendlinxu" <reverendli...@googlemail.com> wrote in message


> >>news:b33ce1e6-0e72-4db6...@j5g2000yqm.googlegroups.com...
>
> >> According to this:
> >>  https://developer.mozilla.org/en/XUL/label
> >> and a couple of books I have, the label element doesn't support
> >> onclick or related handlers.
>
> >> On Jan 7, 5:38 pm, "Susan Crayne" <susancra...@yahoo.com> wrote:
>
> >>> In an existing application that I'm modifying, there is a toolbarbutton
> >>> that
> >>> has a click handler on it. I'd like to change that so that instead of
> >>> the
> >>> handler on the toolbarbutton, there is a handler on the label element
> >>> that
> >>> is the toolbarbutton element's first child. I've tried to do this, and
> >>> the
> >>> label element does not receive the click event. I'd like to know if this
> >>> is
> >>> possible. If it isn't, I can change the xul so that there is, instead of
> >>> a
> >>> toolbarbutton, a box with explicit label and image children. Thanks.
>
> >> _______________________________________________
> >> dev-tech-xul mailing list

> >> dev-tech-...@lists.mozilla.org
> >>https://lists.mozilla.org/listinfo/dev-tech-xul

Susan Crayne

unread,
Jan 9, 2010, 3:32:05 PM1/9/10
to
What I was trying to do was put a click handler on the label child of a
toolbar button when the toolbar button was defined in XBL. This did not
work -- I needed to replace the toolbar button with a vbox that had image
and label children.

"reverendlinxu" <revere...@googlemail.com> wrote in message

news:38ca72c1-7908-4bf7...@z41g2000yqz.googlegroups.com...

Neil

unread,
Jan 9, 2010, 7:04:26 PM1/9/10
to
Susan Crayne wrote:

> In an existing application that I'm modifying, there is a
> toolbarbutton that has a click handler on it. I'd like to change that
> so that instead of the handler on the toolbarbutton, there is a
> handler on the label element that is the toolbarbutton element's first
> child. I've tried to do this, and the label element does not receive
> the click event. I'd like to know if this is possible.

You would need to set allowevents="true" on the label element. (Normally
a button disables events on its children.)

--
Warning: May contain traces of nuts.

0 new messages