Re: NSTextView question
Re: NSTextView question
- Subject: Re: NSTextView question
- From: Rudi Sherry <email@hidden>
- Date: Thu, 16 Mar 2006 11:16:12 -0800
On Mar 16, 2006, at 9:30 AM, Ricky Sharp wrote:
On Thursday, March 16, 2006, at 10:28AM, Rudi Sherry
<email@hidden> wrote:
I have a window with an NSTextView and a button.
I type into the NSTextView, then hit the button. The action of the
method gets the value of the text view with [ mTextView
stringValue ] ... but that is the old value, before I started
editing.
I find I have to hit <return> with focus at the NSTextView in order
to have [ mTextView stringValue ] be the edited value. I don't want
to require this behavior.
I tried [ mTextView validateEditing ] (from NSControl) but that
didn't work either -- [ mTextView stringValue ] was still the old
value.
How do I get the edited value?
I believe you'll have the have the text field end any editing
before obtaining the text. There's some discussion here (see topic
on Forcing the end of editing):
<http://tuvix.apple.com/documentation/Cocoa/Conceptual/TextEditing/
Tasks/BatchEditing.html>
There may be other (better?) techniques as well.
Thanks, I looked at that, but I don't think it's what I need. It
assumes that the window is resigning the key -- which it is not --
and/or the user tabbed out of the edit box -- which they did not.
The button starts some other actions that can leave the window as the
keyWindow and leave the key focus inside the text view... so there
is no notification that textDidEndEditing, since technically it never
did.
I think I need to go into the currentEditor and grab the edit text
directly, ignoring the stringValue of the textView. Does that sound
like a valid way to do it?
Thanks,
Rudi
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden