[comp.sys.mac.programmer] How do I undo style changes in the new TextEdit

ari@eleazar.dartmouth.edu (Ari Halberstadt) (09/26/89)

Here's my problem:
I'm trying to implement the undo feature for the new styled TextEdit.
The way I'd go about it is to save a copy of the text's style handle,
and then apply the new style. To undo the change, I'd simply apply
the saved style handle (for the whole text). However, after
reading through IM-V, I still can't figure out how to get a *copy*
of the style record. Note that making a complete copy of all the
text is unacceptable. There just doesn't seem to be a call
to copy the whole style record at once.

A similar problem, which could be solved the same way as the above
problem, is switching style records for a text edit record. For instance,
having 3 versions of a style for the text, and depending on
the user's choice, applying those style records.

You can email directly to me, and I promise I'll eventually get around
to summarizing. The solution I use will be properly acknowledged in
my code.

--

-- Ari Halberstadt '91, "Long live succinct signatures"
E-mail: ari@eleazar.dartmouth.edu
Disclaimer: "Live Free or Die"

isle@eleazar.dartmouth.edu (Ken Hancock) (09/27/89)

In article <15772@dartvax.Dartmouth.EDU> ari@eleazar.dartmouth.edu (Ari Halberstadt) writes:
:Here's my problem:
:I'm trying to implement the undo feature for the new styled TextEdit.
:The way I'd go about it is to save a copy of the text's style handle,
:and then apply the new style. To undo the change, I'd simply apply
:the saved style handle (for the whole text). However, after
:reading through IM-V, I still can't figure out how to get a *copy*
:of the style record. Note that making a complete copy of all the
:text is unacceptable. There just doesn't seem to be a call
:to copy the whole style record at once.

Use the routines GetStyleScrap and SetStyleScrap.  Note that the former
is documented in IM V, but the later is incorrectly documented in
one of the technotes (207 I think...).

Ken


--
Ken Hancock  '90                     | E-mail: (BITNET/UUCP/INTERNET)
Computer Resource Center Consultant  |    isle@eleazar.dartmouth.edu
-------------------------------------+--------------------------------------
DISCLAIMER?  I don't get paid enough to worry about disclaimers.