• 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: Setting alignment of NSTextView programmatically [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting alignment of NSTextView programmatically [SOLVED]


  • Subject: Re: Setting alignment of NSTextView programmatically [SOLVED]
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 18 Feb 2008 15:14:08 -0800


On Feb 15, 2008, at 12:35 PM, Ken Worley wrote:

Here's the solution I've got for now that works in the sample project:

Take out the alignRight message in the above and replace it with this:

	NSParagraphStyle* tStyle = [NSParagraphStyle defaultParagraphStyle];
	NSMutableParagraphStyle* tMutStyle = [tStyle mutableCopy];
	[tMutStyle setAlignment:NSRightTextAlignment];
	[codeBasedTextView setDefaultParagraphStyle:tMutStyle];

Oddly enough, it does not work if I start with [codeBasedTextView defaultParagraphStyle]. Also, I still can't understand why simply calling alignRight doesn't work since it's supposed to apply to all text if the receiver is plain text...

Here is what is going on in this case:

The text view is set to be non-editable. The method -alignRight: is the UI action for right-aligning text; since user actions do not affect non-editable text, this method does not affect non-editable text views. If you want to right-align programmatically, you can use setAlignment:NSRightTextAlignment instead, or modify the text storage directly.

Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Setting alignment of NSTextView programmatically [SOLVED]
      • From: Ken Worley <email@hidden>
References: 
 >Setting alignment of NSTextView programmatically (From: Ken Worley <email@hidden>)
 >Re: Setting alignment of NSTextView programmatically [SOLVED] (From: Ken Worley <email@hidden>)

  • Prev by Date: Re: folder content as model for NSTableView
  • Next by Date: 10.4 Toolbars
  • Previous by thread: Re: Setting alignment of NSTextView programmatically [SOLVED]
  • Next by thread: Re: Setting alignment of NSTextView programmatically [SOLVED]
  • Index(es):
    • Date
    • Thread