本文介绍了在Finder之类的NSOutlineView中编辑文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在Finder中重命名文件,则文本字段将水平扩展到大约列的宽度。然后,它在滚动之前垂直扩展到三行。我假设必须在大纲视图之外的文本字段中完成此操作。而且我可以在输入时得到一个文本字段来调整大小。我只是不知道在必要时如何将其放置在轮廓视图上。如果大纲视图滚动,则将其固定在行上。有人有见识吗?谢谢!

If you rename a file in the Finder, the text field expands horizontally up to about the width of the column. And then it expands vertically up to three rows before scrolling. I'm assuming this has to be done in a text field outside the outline view. And I can get a text field to resize while I type. I just don't know how to place it over the outline view when necessary. And keep it pinned to the row if the outline view scrolls. Does anyone have any insights? Thanks!

推荐答案

文本编辑由专用的 NSText 处理,称为字段编辑器。此共享的单个视图用于窗口中发生的所有文本编辑。它与通常显示文本的内容(不进行编辑时)是分开的。

Text editing is handled by a dedicated NSText and it’s called "field editor". This shared single view is used for all text editing that happens in the window. It’s separate from what usually displays the text (when not editing).

以下是文档:

如文档讨论部分所述,您可以使用和自定义另一个字段编辑器。这应该是您任务的起点。

As mentioned in the docs discussion section, you can use and customize another field editor. This should be a starting point for your task.

NSControl 文档还包含有关字段编辑器的部分,可能会有所帮助。

NSControl docs also have a section about Field Editor that might help.

这篇关于在Finder之类的NSOutlineView中编辑文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 05:17