Tab stop with fill characters

  • Hi,

    I would like to implement tab stops with fill characters in a
    NSTextView.

    I found a previous reference to some sample code on the list:

    > I was able to find a code snippet at http://cocoa.mamasam.com/
    MACOSXDEV/2002/01/1/21298.php which is roughly similar to what I want
    to achieve. Thanks again,  > you saved my day.

    However that is longer available.

    Can anyone point me at some sample source or suggest a method of
    doing this please?

    Many thanks,

    Ron
  • On Oct 20, 2006, at 5:52 AM, Ron DuCros wrote:

    > Hi,
    >
    > I would like to implement tab stops with fill characters in a
    > NSTextView.
    >
    > I found a previous reference to some sample code on the list:
    >
    >> I was able to find a code snippet at http://cocoa.mamasam.com/
    > MACOSXDEV/2002/01/1/21298.php which is roughly similar to what I
    > want to achieve. Thanks again,  > you saved my day.
    >
    > However that is longer available.
    >
    > Can anyone point me at some sample source or suggest a method of
    > doing this please?

    You should be able to subclass your NSLayoutManager and override
    drawGlyphsForGlyphRange:atPoint:

    In it you'd convert the glyph range to a character range and walk
    through that character range in you text storage and find out if
    there was a tab there.  If there was, convert back from that
    character range to a glyph range, get it's location, and draw your
    dotted lines as needed.

    Glenn Andreas                      <gandreas...>
      <http://www.gandreas.com/> wicked fun!
    quadrium | flame : flame fractals & strange attractors : build,
    mutate, evolve, animate
previous month october 2006 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