Re: NSTextView - firstResponder notification?
Re: NSTextView - firstResponder notification?
- Subject: Re: NSTextView - firstResponder notification?
- From: Mike Abdullah <email@hidden>
- Date: Sat, 18 Mar 2006 00:44:01 +0000
Out of interest (seeing as it wasn't me who asked the question), why
do you use performSelector:withObject:afterDelay in this case?
Mike.
On 18 Mar 2006, at 00:20, Jordan Krushen wrote:
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
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