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

Newlines in a NSTextField...still struggling


  • Subject: Newlines in a NSTextField...still struggling
  • From: "Huyler, Christopher M" <email@hidden>
  • Date: Fri, 5 Dec 2003 14:02:58 -0500
  • Thread-topic: Newlines in a NSTextField...still struggling

Ok, I figured out that by calling "setFieldEditor:NO" on the window's
field editor, I can allow the user to enter newlines in the field.
However, I'm not sure where/how to do this. I am trying the following
in the NSTextField's delegate class:

-(BOOL)control:(NSControl *)control
textShouldBeginEditing:(NSText *)fieldEditor
// when the user
{
if ( control == approvedField )
{
[fieldEditor setFieldEditor:NO];
}
else
{
[fieldEditor setFieldEditor:YES];
}
return YES;
}

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?


--
Christopher Huyler
Computer Associates Intl.
mailto:email@hidden
_______________________________________________
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.

  • Follow-Ups:
    • Re: Newlines in a NSTextField...still struggling
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: Re: make a list
  • Next by Date: Re: windows title bar at left
  • Previous by thread: Re: windows title bar at left
  • Next by thread: Re: Newlines in a NSTextField...still struggling
  • Index(es):
    • Date
    • Thread