简体   繁体   English

单击按钮时如何在NSTextView中保存文本

[英]How to save the text in a NSTextView when clicking on a button

So I have a textview , and a button that sends the contents of the textview elsewhere. 所以我有一个textview ,以及一个将textview的内容发送到其他地方的按钮。

When I edit the TextView , and then hit enter or tab, I can then send that string properly. 当我编辑TextView ,然后按Enter或Tab时,我可以正确地发送该字符串。

However, if I edit the TextView and just straight hit the button, the changes I made to the string don't get sent. 但是,如果我编辑TextView并直接按下按钮,则不会发送对字符串所做的更改。

I tried changing the action to "Sent on End Editing" and I have bound sent action "textchanged" appropriately, but it isn't working for me yet. 我尝试将操作更改为“已发送结束编辑”,并且已将发送的操作适当地绑定为“ textchanged”,但是它不适用于我。

Found a better route; 找到了一条更好的路线; just checked "Continuously Updates Value" in the Bindings inspector under Value. 刚刚在“绑定”检查器中的“值”下选中了“连续更新值”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM