NSTextView and front/middle/back ellipses

  • I have a simple text view that will display its text information with an
    ellipses on the right (end) if the string is too long for the view. Nice,
    but...

    How can I tell NSTextView to use a "front" or "middle" ellipses for viewing
    purposes?

    -h
  • On Jan 22, 2009, at 11:03 AM, Harry Plate wrote:

    > I have a simple text view that will display its text information
    > with an
    > ellipses on the right (end) if the string is too long for the view.
    > Nice,
    > but...
    >
    > How can I tell NSTextView to use a "front" or "middle" ellipses for
    > viewing
    > purposes?

    You'll have to set a (mutable) paragraph style, and specify
    NSLineBreakByTruncatingHead or NSLineBreakByTruncatingMiddle for the
    NSLineBreakMode using -setLineBreakMode:.
  • Randall,

    <snip>
    >> How can I tell NSTextView to use a "front" or "middle" ellipses for
    >> viewing
    >> purposes?
    >
    > You'll have to set a (mutable) paragraph style, and specify
    > NSLineBreakByTruncatingHead or NSLineBreakByTruncatingMiddle for the
    > NSLineBreakMode using -setLineBreakMode:.

    Thanks a bunch! The hint led me to "Breaking Lines by Truncation" in the
    "Rulers and Paragraph Styles" doc. Within that are some very useful code
    fragments illustrating what to do.

    I'm off to the races,

    -harry
previous month january 2009 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Go to today