可可文本字段禁用不会禁用光标更改
你好,我有一个盒子,其中一行有 2 个 NSTextFields。
此外,在特定操作上,自定义半透明视图会出现在这 2 个文本字段上。然后进行其他操作时,就会消失。
当这些文本字段被半透明视图覆盖时,我希望它们被禁用,并且当光标进入任何这些文本字段的区域时,我的光标不会改变。然后我希望它们在我的自定义视图消失时启用。
我分别使用以下命令:
[fileNameField setEnabled:NO];
[folderPathField setSelectable:NO];
[folderPathField setEnabled:NO];
和
[fileNameField setEnabled:YES];
[folderPathField setEnabled:YES];
[folderPathField setSelectable:YES];
来完成此操作。
问题是,一个名为 fileNameField 的更改正确:它变得有点暗,当光标位于文本字段上方时,它既不会被选中,也不会更改我的光标。
但另一个,folderPathField 也被禁用,无法选择文本,但当它进入它的区域时它仍然会改变我的光标。
这两个文本字段之间的唯一区别是:
1. fileNameField 有圆角边框,folderPathField 无边框。
2. fileNameField 的布局设置为“滚动”,folderPathField 的布局设置为“截断”。
有人知道这种行为的原因是什么吗?
Hello I have a box with 2 NSTextFields in one row.
Also on specific action a custom semiopaque view appears over these 2 textfields. And then on other action, disappears.
When these texfields are covered with the semiopaque view I want them to become disabled and my cursor not to change when it comes into the area of any of these textfields. And then I want them to become enabled when my custom view disappears.
I do it using the following commands:
[fileNameField setEnabled:NO];
[folderPathField setSelectable:NO];
[folderPathField setEnabled:NO];
and
[fileNameField setEnabled:YES];
[folderPathField setEnabled:YES];
[folderPathField setSelectable:YES];
respectively.
The problem is that one called fileNameField does change correctly: it becomes a bit dimmed and doesn't either get selected or change my cursor when it is over the textfield.
But another one, folderPathField also becomes disabled, it isn't possible to select the text, but it still changes my cursor when it enters it's area.
The only differences between these two textfields are:
1. fileNameField has rounded border and folderPathField has no border.
2. fileNameField has layout set to "Scrolls" and folderPathField - "Truncates".
Does somebody know what can be the reason for such behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
需要将其设置为不可编辑
You need to set it to not be editable