• 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: Newlines in a NSTextField...still struggling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newlines in a NSTextField...still struggling


  • Subject: Re: Newlines in a NSTextField...still struggling
  • From: Douglas Davidson <email@hidden>
  • Date: Fri, 5 Dec 2003 11:55:11 -0800

On Dec 5, 2003, at 11:02 AM, Huyler, Christopher M wrote:

However, this delegate function only gets called if I am about to edit
the field. I have to attempt to change something in the field to get
this to run. After that I can insert newlines all I want. This does
not work when the first character I want to type is a newline.

Is there a better way to do this?

Yes. Try this instead:

- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector {
BOOL retval = NO;
if (commandSelector == @selector(insertNewline:)) {
retval = YES;
[textView insertNewlineIgnoringFieldEditor:nil];
}
return retval;
}

Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Newlines in a NSTextField...still struggling (From: "Huyler, Christopher M" <email@hidden>)

  • Prev by Date: Re: Drawing in Cocoa
  • Next by Date: Re: Xcode bug
  • Previous by thread: Newlines in a NSTextField...still struggling
  • Next by thread: Re: Xcode bug
  • Index(es):
    • Date
    • Thread