Text Editing without NSTextView?

  • Hello list-

    I'm building an Illustrator-like graphic editing system as part of a larger application I'm working on and I want the user to have the ability to add text objects.  I'm trying to figure out the best way to do this -- ideally I'd use an NSTextView, but when I add the text view as a subview to the custom draw view where all the other shapes are drawn the text is always on top of any of the shapes that get rendered to the draw view (Of course).

    My other option is to use the text containers drawGlyphsForGlyphRange method -- which is fine by me, but the problem is I want the user to be able to select/edit the text and I'm not sure if it's even possible to do that without using an NSTextView.

    Any thoughts?

    Thanks!

    Mike
  • > I'm building an Illustrator-like graphic editing system as part of a larger application I'm working on and I want the user to have the ability to add text objects.  I'm trying to figure out the best way to do this -- ideally I'd use an NSTextView, but when I add the text view as a subview to the custom draw view where all the other shapes are drawn the text is always on top of any of the shapes that get rendered to the draw view (Of course).

      This makes perfect sense if you're actively editing things. If
    you're just displaying a shape with text in it, you can of course draw
    the text (with similar attributes to your editing text view) into a
    rectangle when drawing your shape. Check out the Sketch example in the
    developer example code in your Developer folder.

    --
    I.S.
  • I'm about to implement something similar (for another purpose) and
    really wish that they had separated the editing code from NSTextView so it
    could be used more directly without the view.  (I wrote my own text editor
    for MacOS 9.)  I'll probably just use the "Sketch" approach his time with
    the floating edit view, but with my own text container.

        BTW, I have a text container that works for arbitrary Bezier shapes,
    including ones with holes and bumps.  You can see some examples at
    <www.ed4u.com/textflow>.  Keep in touch if you would like to try it later.
    If I can manage to compile it as a component, I may let it out for trials.

    >
    > Hello list-
    >
    > I'm building an Illustrator-like graphic editing system as part of a larger
    > application I'm working on and I want the user to have the ability to add text
    > objects.  I'm trying to figure out the best way to do this -- ideally I'd use
    > an NSTextView, but when I add the text view as a subview to the custom draw
    > view where all the other shapes are drawn the text is always on top of any of
    > the shapes that get rendered to the draw view (Of course).
    >
    > My other option is to use the text containers drawGlyphsForGlyphRange method
    > -- which is fine by me, but the problem is I want the user to be able to
    > select/edit the text and I'm not sure if it's even possible to do that without
    > using an NSTextView.
    >
    > Any thoughts?
    >
    > Thanks!
    >
    > Mike
    >
  • Le 8 janv. 08 à 19:46, Gordon Apple a écrit :

    > I'm about to implement something similar (for another purpose) and
    > really wish that they had separated the editing code from NSTextView
    > so it
    > could be used more directly without the view.  (I wrote my own text
    > editor
    > for MacOS 9.)  I'll probably just use the "Sketch" approach his time
    > with
    > the floating edit view, but with my own text container.
    >
    > BTW, I have a text container that works for arbitrary Bezier
    > shapes,
    > including ones with holes and bumps.  You can see some examples at
    > <www.ed4u.com/textflow>.  Keep in touch if you would like to try it
    > later.
    > If I can manage to compile it as a component, I may let it out for
    > trials.
    >
    >>
    >> Hello list-
    >>
    >> I'm building an Illustrator-like graphic editing system as part of
    >> a larger
    >> application I'm working on and I want the user to have the ability
    >> to add text
    >> objects.  I'm trying to figure out the best way to do this --
    >> ideally I'd use
    >> an NSTextView, but when I add the text view as a subview to the
    >> custom draw
    >> view where all the other shapes are drawn the text is always on top
    >> of any of
    >> the shapes that get rendered to the draw view (Of course).
    >>
    >> My other option is to use the text containers
    >> drawGlyphsForGlyphRange method
    >> -- which is fine by me, but the problem is I want the user to be
    >> able to
    >> select/edit the text and I'm not sure if it's even possible to do
    >> that without
    >> using an NSTextView.
    >>
    >> Any thoughts?
    >>
    >> Thanks!
    >>
    >> Mike

    Have a look at CoreText (http://developer.apple.com/documentation/Carbon/Conceptual/CoreText_Program
    ming/

    ) and ATSUI (http://developer.apple.com/documentation/Carbon/Conceptual/ATSUI_Concepts/
    ), it may help you in what your planning to do.
previous month january 2008 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