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

Creating very custom button. Some troubles with oncommand.

6 views
Skip to first unread message

Borisov M. Gleb

unread,
May 5, 2009, 11:08:50 AM5/5/09
to
Hi, all!

I'm trying to create very custom button (now it's simple, but in
future I want to add more UI to it).

<binding id="button" display="myns:button" extends="chrome://
global/content/bindings/button.xml#button">
<resources>
<stylesheet src="chrome://myextension/skin/myskin.css"/>
</resources>
<content>
<children includes="observes|template|menupopup|tooltip"/>
<xul:box class="myns-button">
<xul:box class="myns-normal-button" flex="1"
align="center" pack="center" xbl:inherits="class,disabled">
<xul:box class="myns-button-left" />
<xul:label class="myns-button-label"
xbl:inherits="value=label,accesskey" flex="1" />
</xul:box>
</xul:box>
</content>
</binding>

And use it in another XBL like this:
<myns:button anonid="copy-me" label="Copy Me"/>

How I can add "oncommand" functionality to my button? (I tried inherit
onclick on xul:box with class myns-button, but I can't write smth
like: <myns:button ... onclick="document.getBindingParent(this).smth
();"/> because context changed during XBL-inheritance).

Thanks for your attention.

--
Kind regards,
Gleb M. Borisov

Martijn

unread,
May 5, 2009, 11:13:19 AM5/5/09
to Borisov M. Gleb, dev-te...@lists.mozilla.org


In what namespace is myns? If it is your own custom namespace, then
onclick, oncommand attributes won't work, afaik, because you're then
working with generic xml elements..

Regards,
Martijn

> --
> Kind regards,
> Gleb M. Borisov

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

--
Martijn Wargers - Help Mozilla!
http://quality.mozilla.org/
http://wiki.mozilla.org/Mozilla_QA_Community
irc://irc.mozilla.org/qa - /nick mw22

Borisov M. Gleb

unread,
May 5, 2009, 11:20:42 AM5/5/09
to
On May 5, 7:13 pm, Martijn <martijn.mart...@gmail.com> wrote:

> On Tue, May 5, 2009 at 5:08 PM, Borisov M. Gleb <borisov.g...@gmail.com> wrote:
> > I'm trying to create very custom button (now it's simple, but in
> > future I want to add more UI to it).

> > How I can add "oncommand" functionality to my button? (I tried inherit
> > onclick on xul:box with class myns-button, but I can't write smth
> > like: <myns:button ... onclick="document.getBindingParent(this).smth
> > ();"/> because context changed during XBL-inheritance).
>

> In what namespace is myns? If it is your own custom namespace, then
> onclick, oncommand attributes won't work, afaik, because you're then
> working with generic xml elements..

myns is custom namespace. I've tried using xul:oncommand, but it's not
working too. And I can't find anything about oncommand implementation
in global/bindings/button.xml :(

Thanks for your attention.

Boris Zbarsky

unread,
May 5, 2009, 12:05:17 PM5/5/09
to
Borisov M. Gleb wrote:
> myns is custom namespace. I've tried using xul:oncommand, but it's not
> working too.

Your _element_ needs to be in the xul namespace. oncommand is something
XUL elements implement.


-Boris

Neil Deakin

unread,
May 5, 2009, 12:40:56 PM5/5/09
to
Borisov M. Gleb wrote:
> Hi, all!
>
> I'm trying to create very custom button (now it's simple, but in
> future I want to add more UI to it).
>
> <binding id="button" display="myns:button" extends="chrome://
> global/content/bindings/button.xml#button">

You probably want display="xul:button". Or, better, just leave it out
entirely.

Neil

unread,
May 6, 2009, 5:24:20 AM5/6/09
to
Boris Zbarsky wrote:

To clarify, oncommand is an event attribute name for XUL, and does not
have a namespace. Your element also needs to be a XUL button element (or
have an XBL display type of xul:button) in order to generate command
events when it is clicked or space or Enter is pressed.

--
Warning: May contain traces of nuts.

0 new messages