Re: NSTextView - firstResponder notification?
Re: NSTextView - firstResponder notification?
- Subject: Re: NSTextView - firstResponder notification?
- From: "Jordan Krushen" <email@hidden>
- Date: Fri, 17 Mar 2006 16:20:23 -0800
On 3/17/06, Arne Bech <email@hidden> wrote:
> I have a NSTextView in a window (along with some other stuff). The
> NSTextView is by default showing the word "notes". Is there any way
> to make that text selected whenever the user cliks or tabs into the
> textView? and possible so only when it has the word "notes"?
You could subclass NSTextView in IB, create the files for it, set the
view's custom class to your new subclass, and stick this in the
implementation (not thoroughly tested):
- (BOOL)becomeFirstResponder
{
NSString *viewText = [[self textStorage] string];
if ([viewText isEqualToString:@"notes"]) {
NSLog(@"text is 'notes', selecting");
[self performSelector:@selector(selectAll:) withObject:self afterDelay:0];
}
return YES;
}
HTH,
J.
_______________________________________________
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