Re: Custom Object in Attributed String
Re: Custom Object in Attributed String
- Subject: Re: Custom Object in Attributed String
- From: Lorenzo <email@hidden>
- Date: Fri, 17 Feb 2006 11:27:37 +0100
Thank you so much. I will work on that and let you know.
Best Regards
--
Lorenzo
email: email@hidden
>
> From: Douglas Davidson <email@hidden>
> Date: Thu, 16 Feb 2006 17:59:18 -0800
> To: Lorenzo <email@hidden>
> Cc: email@hidden
> Subject: Re: Custom Object in Attributed String
>
>
> On Feb 15, 2006, at 10:55 AM, Lorenzo wrote:
>
>>
>> I would like to insert my custom hyper-text within an attributedString.
>>
>>
>> It is a formatted number looking like 00.00 or 000.0
>>
>>
>> The user cannot modify the text of this object but he can select it and
>>
>>
>> change the font/size/style/color of the interger part or the decimal part.
>>
>>
>> He could vary the formatter of the number like we developers use to do with
>>
>>
>> Interface Builder.
>>
>>
>>
>>
>>
>> Where should I learn to add and manage hyper-text to my attributedString?
>>
>
> The behavioral changes can most likely be done at the text view delegate
> level; take a look at the delegate methods starting with shouldChange, which
> you can use to e.g. forbid any changes that change the text (as opposed to the
> attributes) of a range intersecting a given range. You can also control user
> changes to selected ranges, if you want to do that.
>
> How do you keep track of where your custom text is in the document? For that,
> I would suggest using a custom attribute. Just pick a name and values for
> your attribute, and add it to your string in the appropriate ranges; then your
> delegate methods can look for this attribute. You may want to use different
> values for different instances (what happens if two instances of this special
> text abut each other?)
>
> You will want to consider what happens to your special text under copy/paste.
> Obviously when you paste into another app that doesn't recognize this
> behavior, the text will no longer be special, but what do you want to happen
> within your app? If you want to preserve custom attributes, you'll need to
> add a custom pasteboard type; custom attributes are preserved, for example,
> under archiving, but not under the RTF representation that is used by default
> for rich text on the pasteboard.
>
> Douglas Davidson
>
>
_______________________________________________
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