[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom text view

From: Dr. H. Nikolaus Schaller
Subject: Re: Custom text view
Date: Sat, 23 Feb 2013 11:07:47 +0100

Am 23.02.2013 um 10:55 schrieb Luis Garcia Alanis:

> Hello guys, 
> I want to create a custom text view. This seems to be hard and I don't know 
> where to start.
> I want to be able to type text but have a big space between each line so that 
> I can then tag a balloon on top of a letter that will follow the letter if I 
> write text before it. Kind of like:
>                  (Baloon with text goes here)
> This is some sample text. And some more text........ etc.
> So the balloon would be on top of a letter and then if I type something in 
> the beginning the balloon will move kind of like if it was anchored to the 
> letter.
> NSTextView seems not to fit this scenario.

It can be part of the scenario.

> Ideas are welcomed :)

You need a text view for typing etc. And a floating NSPanel that your code 
moves around (balloon).

Basic idea: add a delegate to NSTextView receiving selection change 
notifications and move the NSPanel around and/or change its contents. This code 
could also change line spacing of the text if needed.

An alternative could be to play with the typesetter (subclass) to add more line 
spacing and add glyphs for additional text but that may be very fragile and 
difficult to debug.

Yet another alternative could be to add an NSTextAttachment that displays you 
ballon. Like an image inserted in a text document.

-- hns

reply via email to

[Prev in Thread] Current Thread [Next in Thread]