• 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: Respecting tabs across applications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Respecting tabs across applications


  • Subject: Re: Respecting tabs across applications
  • From: James Merkel <email@hidden>
  • Date: Thu, 12 Jan 2012 11:10:01 -0800

On Jan 11, 2012, at 2:40 PM, James Merkel wrote:

>
> On Jan 11, 2012, at 8:39 AM, Ross Carter wrote:
>
>> On Jan 10, 2012, at 10:14 PM, James Merkel wrote:
>>
>>> the default NSParagraphStyle is being applied to my string.
>>
>> To be precise, a NSParagraphStyle is being applied to your attributed string. The NSString does not contain any formatting information.
>>
>> When you copy rich text, say from TextEdit, you place two sets of data on the pasteboard: the rich text data with the NSParagraphStyle and font information, and plain text data, which is just the characters. When you paste into a document, the receiving app chooses the item on the pasteboard that it wants to use. A code editor might prefer the plain text version, whereas a word processor would prefer the rich text version.
>>
>> If you want the text to line up neatly in an app that takes plain text from the pasteboard, you probably want to align everything using spaces, as Jens said. If you want the text to align in an app that uses rich text, you should use tabs and define their location using NSParagraphStyle. To handle both possibilities, you need to manage what gets put on the pasteboard. If you are using NSTextView, there are some pasteboard methods available for you to override.
>>
>> Ross
>
> I'm using my own defined NSParagraphStyle now for the tabstops and that works fine. That's a cleaner and more maintainable approach than I was using before. So thanks to Jens for that suggestion.
> I would like to be able to copy and paste to TextEdit and maintain the attributes (including bolded text). I'll take a look at the pasteboard methods of NSTextView.
>
> Thanks
> Jim Merkel
>
>
Turns out, all I needed to do was check the "Allows Rich Text" check box in the NSTextView Attributes Inspector in Interface Builder to allow the two types of text (Rich Text and plain text) to be copied to the pasteboard.
No coding required - excellent.

Jim Merkel
_______________________________________________

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

References: 
 >Respecting tabs across applications (From: James Merkel <email@hidden>)
 >Re: Respecting tabs across applications (From: Jens Alfke <email@hidden>)
 >Re: Respecting tabs across applications (From: James Merkel <email@hidden>)
 >Re: Respecting tabs across applications (From: Jens Alfke <email@hidden>)
 >Re: Respecting tabs across applications (From: James Merkel <email@hidden>)
 >Re: Respecting tabs across applications (From: Jens Alfke <email@hidden>)
 >Re: Respecting tabs across applications (From: James Merkel <email@hidden>)
 >Re: Respecting tabs across applications (From: Ross Carter <email@hidden>)
 >Re: Respecting tabs across applications (From: James Merkel <email@hidden>)

  • Prev by Date: AppleScript recording
  • Next by Date: document saveing in Lion
  • Previous by thread: Re: Respecting tabs across applications
  • Next by thread: Alias, Dock drag, and NSOpenPanel
  • Index(es):
    • Date
    • Thread