[comp.sys.mac.programmer] Editable TextItems in Dialogs

merchant@eleazar.dartmouth.edu (Peter Merchant) (01/25/89)

From article <3543@ucdavis.ucdavis.edu>:
>I would like to be able to parse a string as it is being typed
>into an editable textitem field of a dialog, and have all numbers
>typed appear subscripted relative to the rest of the string.
>
>For instance, if I were to type the string 'C6H6' I would like
>the number six to be subscripted in all occurrences - as in
>a molecular formula.  I would like to be able to do this 'on
>the fly' - ie. as the string is being typed.

I can't give you a code fragment, alas, as my code doesn't do exactly this,
but you might want to check out the new TextEdit chapter of Inside Macintosh
Volume V.  I'm using it to construct bold and normal text in a TextEdit
record, so you should be able to use it to construct superscripts and
subscripts by merely adjusting the lineheight.

I tried to do exactly this once without the new TextEdit and it was a
miserable job and never really worked well.  My suggestion is to use the new
TextEdit.
---
                                       Peter Merchant (merchant@eleazar.UUCP)
                                             (Peter.G.Merchant@dartmouth.EDU)

P.S. Sorry about posting this, but the mailer burped...