XUL/Thunderbird:开始编辑返回
我正在使用雷鸟代码库,目的是实现内联联系人编辑。当前代码捕获 XUL
树上的 Click
事件,如果是双击 (events.detail == 2
),则会打开配置文件编辑器。我对其进行了修改,以便开始编辑当前的 treeCell
,并且我确实将 editable=true
添加到相应的 XUL
文档中。更新后的代码读取
var orow = {}, ocolumn = {}, opart = {};
gAbResultsTree.treeBoxObject.getCellAt(event.clientX, event.clientY,
orow, ocolumn, opart);
var row = orow.value, column = ocolumn.value.index;
if (row == -1)
return;
if (event.detail == 2)
gAbResultsTree.startEditing(row, column);
不幸的是,当代码到达 startEditing
部分时,它返回
Error: uncaught exception: [Exception..."Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLMENTED) [nsITreeView.isEditable ]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLMENTED)" 位置: "JS 框架:: chrome://global/content/bindings/tree.xml :: startEditing :: line 337" data: no]
我在这里几乎迷失了。有更多 XUL 经验的人可以帮忙吗? 谢谢!
I'm playing with the thunderbird codebase, the aim being to implement inline contact editing. The current code catches the Click
event on a XUL
tree, and if it's a double click (events.detail == 2
), it open the profile editor. I modified it so as to start editing the current treeCell
, and I did add editable=true
to the corresponding XUL
document. The updated code reads
var orow = {}, ocolumn = {}, opart = {};
gAbResultsTree.treeBoxObject.getCellAt(event.clientX, event.clientY,
orow, ocolumn, opart);
var row = orow.value, column = ocolumn.value.index;
if (row == -1)
return;
if (event.detail == 2)
gAbResultsTree.startEditing(row, column);
Unfortunately, when the code reaches the startEditing
part, it returns
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsITreeView.isEditable]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame :: chrome://global/content/bindings/tree.xml :: startEditing :: line 337" data: no]
I'm pretty much lost here. Could someone with more XUL experience help?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我试图做类似的事情,但我遇到了同样的问题。
原始abview设置为
__proto__
并覆盖函数的包装器工作正常,直到它被设置为abResultsTree的视图。我终于找到了(我希望)一个优雅的解决方案。
它被实现为一个组件来替换原始的 abview,但它可能会被修改为仅创建一个包装器。
I was trying to do something similar and I have same problem.
Wrapper with original abview set as
__proto__
with functions overriden works fine until it is set as abResultsTree's view.I've finally found (I hope) an elegant solution.
It's implemented as a component to replace the original abview, but it might be modified to just create a wrapper.
小部件使用 nsITreeView 对象来检索或操作需要显示的数据。有预定义的 nsITreeView 实现从 DOM 或 RDF 数据源读取数据,但可以选择使用自己的树视图。 Thunderbird 的地址簿选择后者:不幸的是,有问题的组件是用 C++ 实现的,位于文件 nsAbView.cpp。这意味着在不重新编译 Thunderbird 的情况下更改它是不可能的。并且现有组件未实现编辑树单元格所需的
isEditable()
和setCellText()
方法。如果您还不想搞乱 C++,您可以将该组件包装在您自己的对象中。像这样的事情:
方法
isEditable()
应再次检查此特定单元格是否可编辑 - 即使该列可编辑,单个单元格也不必如此。setCellText()
应该存储单元格的新值。The
<tree>
widget uses an nsITreeView object to retrieve or manipulate data that needs to be displayed. There are predefinednsITreeView
implementations reading data from the DOM or RDF datasources but one can choose to use his own tree view. Thunderbird's address book chooses the latter:Unfortunately for you, the component in question is implemented in C++, in the file nsAbView.cpp. This means that changing it without recompiling Thunderbird isn't possible. And the existing component doesn't implement
isEditable()
andsetCellText()
methods that would be required to edit tree cells.If you don't want to mess with C++ yet, you could wrap that component in your own object. Something like this:
Method
isEditable()
should check again whether this particular cell is editable - even if the column is editable, individual cells don't have to be. AndsetCellText()
should store the new value for the cell.