列表单元 XUL 中的按钮
有没有办法让列表单元格中的按钮在 XUL 中工作?我不确定是什么阻止了它的运行。 XUL 看起来像:
<listitem id = "1">
<listcell label = "OK Computer"/>
<listcell label = "Radiohead"/>
<listcell label = "1997"/>
<listcell label = "Platinum"/>
<listcell label = "5/5"/>
<listcell label = "Alternative Rock"/>
<button label = "Edit" oncommand= "alert('Hello World');"/>
<button label = "Delete" oncommand = "deleteItem();"/>
</listitem>
该按钮在列表之外工作正常,但当它位于列表中时,我的鼠标指针甚至无法将其识别为按钮(通过更改为手形指针)。有什么想法吗?
Is there a way to get buttons in a listcell to work in XUL? I'm not sure what is stopping it from running. The XUL looks like :
<listitem id = "1">
<listcell label = "OK Computer"/>
<listcell label = "Radiohead"/>
<listcell label = "1997"/>
<listcell label = "Platinum"/>
<listcell label = "5/5"/>
<listcell label = "Alternative Rock"/>
<button label = "Edit" oncommand= "alert('Hello World');"/>
<button label = "Delete" oncommand = "deleteItem();"/>
</listitem>
The button works fine outside of the list but my mouse pointer doesn't even recognize it as a button (by changing to a hand pointer) when it's in the list. Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
按钮和其他控制元素可以在标准列表项中使用,不需要使用richlistbox或树。神奇的技巧是
allowevents
属性。您可能还想将按钮包装在列表单元格本身中,以便它们获得自己的列。Buttons and other control elements can be used in a standard listitem, it is not required to use richlistbox or tree. The magic trick is the
allowevents
attribute. You might also want to wrap the buttons in a listcell itself so they get their own column.您需要将按钮放在列表单元格内:
列表单元格可以具有默认内容(如果您仅添加
label
属性并且没有内容,就会得到该内容)或您想要的任何内容 - 但是对于后者,您实际上必须显式地将内容放入
标记中。编辑:实际上,更重要的问题是
的内容相当有限,它大多局限于纯文本。这就是为什么更通用的
小部件具有已开发。但是它不支持表格内容。You need to put the buttons inside the list cell:
A list cell can either have the default contents (which is what you get if you simply add a
label
attribute and no contents) or anything you want - but for the latter you actually have to put the contents into the<listcell>
tag explicitly.Edit: Actually, the more important problem is that
<listbox>
is rather restricted concerning its contents, it is mostly limited to plain text. Which is why the more generic<richlistbox>
widget has been developed. It doesn't support tabular content however.