NSTextField 中的文本格式
我有一个图形应用程序,它使用 NSTextField 实例进行就地文本编辑,这个功能是很久以前添加的,我从来没有理由检查它,但是,我最近收到了一份报告:文本归档不允许文本格式化。格式->文本菜单子项全部被禁用,因此无法设置文本项的段落。
问题:我应该如何设置 NSTextField 以支持段落编辑?我确信它之前确实有效,因为我有一些带有格式化文本的项目,并且自从应用程序诞生以来 NSTextField 就在那里。我是否错过了系统/XCode 更新的某些内容?
我的 NSTextField 是多行的,可编辑的,允许编辑文本属性。
I have a graphics app that uses a NSTextField instance for in-place text editing, this feature was added long time ago and I never had a reason to check it, however, I have recently received a report: text filed doesn't allow text formatting. Format -> Text menu subitems are all disabled, so there is no way to set the paragraph of a text item.
The question: how should I set up the NSTextField to support paragraph editing? I'm sure it did work before since I have some projects with formatted text and NSTextField was there since the app was born. Did I miss something with system/XCode updates?
My NSTextField is multiline, editable, allowed to edit text attributes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果将来有人遇到这个问题,我可以详细描述这个问题:
这会导致使用 NSTextField 时禁用文本格式。
解决方案是对 NSWindow 进行子类化:
瞧,格式化又回来了。
If someone will face this in the future, I can describe the problem in details:
This results disabled text formatting when using NSTextField.
Solution is to subclass the NSWindow:
And voila, formatting is back.