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
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
> 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.
Your _element_ needs to be in the xul namespace. oncommand is something
XUL elements implement.
-Boris
You probably want display="xul:button". Or, better, just leave it out
entirely.
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.