• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextView - firstResponder notification?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSTextView - firstResponder notification?
      • From: Mike Abdullah <email@hidden>
References: 
 >NSTextView - firstResponder notification? (From: Arne Bech <email@hidden>)

  • Prev by Date: Using LDAP framework with SSL
  • Next by Date: Re: NSTextView - firstResponder notification?
  • Previous by thread: NSTextView - firstResponder notification?
  • Next by thread: Re: NSTextView - firstResponder notification?
  • Index(es):
    • Date
    • Thread