Re: Saving ruler markers to defaults
Re: Saving ruler markers to defaults
- Subject: Re: Saving ruler markers to defaults
- From: Douglas Davidson <email@hidden>
- Date: Mon, 19 Aug 2002 12:06:00 -0700
On Saturday, August 17, 2002, at 04:50 AM, Jeremy Dronfield wrote:
Thanks, but no, what I want to save is the state of the tab markers on
the ruler. At least, I *think* that's what I want to save. What I have
is a notepad application which reuses the same NSTextView for a
succession of notes. One note may be some paragraphs of text, the next
may be a list of items aligned left with corresponding tabbed comments
two inches to the right, and so on. I'd like to save the ruler
settings that go with each note, so that when the user returns to add
things to their list, say, they only have to tab once (rather than
three or four times) to put their comments. Or whatever the case may
be.
I still think that's not what you want to save. Sherm's suggestion is
probably the best--just save the whole file as rtf. That way you get
not only paragraph styles, but all other text attributes, saved and
restored for free. Remember that paragraph style can change from one
paragraph to the next in a single document.
If for some reason you have to save as plain text, and you restrict
programmatically to a single paragraph style for the whole document,
then still what you want to save is not the tab markers but the
paragraph style that they represent. You're working at the view level
when you should be working at the model level. You can save a
paragraph style to defaults most easily by archiving it.
In any case, however, you cannot simply set an arbitrary object as a
default; defaults must be property lists.
Yes, I know. According to the class docs, -rulerMarkersForTextView:
returns an array, which, if documentation and experience don't deal me
a doody, can be set as an object in user defaults. Or can't it in this
case?
To be a property list, the objects contained in the array must also be
property list types, and so on recursively.
Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.