Text attachments - making an NSTextAttachment unique?
Text attachments - making an NSTextAttachment unique?
- Subject: Text attachments - making an NSTextAttachment unique?
- From: Keith Blount <email@hidden>
- Date: Thu, 27 Oct 2005 16:20:25 -0700 (PDT)
Hello,
I am currently using NSTextAttachment and
NSTextAttachmentCell to draw custom buttons inside a
text view, but am experiencing problems. The problems
I have seem to lie with the way that the text system
deals with attributes. The text system assumes that
text attributes don't change, and so may "merge" two
different attribute objects into the same objects (or
at least this is how I understand the docs on
NSAttributedString). This is a big assumption which is
causing me lots of grief. For instance, I may create a
text attachment cell that gets highlighted when the
cursor is next to it. However, if I create two such
attachments next to each other and move the cursor
next to one of them, both will get highlighted -
presumably because the text system has "merged" them
into a single attribute, so now the same cell is beign
used across two different ranges. So when I check the
cell at a particular place in the text, it is really
meaningless, because the same cell might exist at
several places in the text - even though I originally
created individual cells, those that seem the same
(according to -isEqual:?) get merged...
My question is, how do I prevent this? If I want to
ensure that the attributes across a particular range
are unique, and that my custom attachment cell only
exists at one point in the text, what do I do? The
docs' suggestions only relate to changing attributes
behind the scenes, which doesn't really help here...
Many thanks in advance,
Keith
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden