在运行时更改 Firefox addon sdk 工具栏按钮图标
我正在使用工具栏按钮库,因为如果我重新启动 Firefox,普通的小部件将不会存储它们的位置。 不幸的是我想在运行时更改图标。使用我尝试过的小部件:
widget.contentURL = "http://127.0.0.1:8082/static/icons/eth_16.png";
使用我尝试过的工具栏按钮:
Toolbarbutton.image = "http://127.0.0.1:8082/static/icons/eth_16.png";
没有任何效果。该图像似乎仅在构造工具栏按钮时使用。
还尝试销毁并使用不同的图标重新创建按钮,但这会导致烦人的闪烁。
任何想法将不胜感激。
I'm using the toolbarbutton library, because the normal widgets would not store their positions if I restart Firefox.
Unfortunately I want to change the icon on runtime. With the widgets I did:
widget.contentURL = "http://127.0.0.1:8082/static/icons/eth_16.png";
With the toolbarbuttons I tried:
Toolbarbutton.image = "http://127.0.0.1:8082/static/icons/eth_16.png";
without any effect. The image seems to be only used when construction the toolbarbutton.
Also tried to destroy and recreate the button with a different icon, but that causes annoying flickering.
Any idea would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我做了一个快速测试,这应该按预期工作,所以我不确定您在这里遇到了什么问题。下面是一些运行良好的示例代码:
您可以发布更多代码吗?问题一定出在其他地方。
I did a quick test and this should work as expected so I'm not sure what issue you're running into here. Here's some example code that works just fine:
Is there more code you could post? The problem must be somewhere else.