Copyright © 1993-94 Apple Computer, Inc. All rights reserved. Wrap It Up by Bob Ebert and J. Christopher Bell This sample illustrates dynamically changing the height of clParagraphViews based on their contents. Two ways to do it are illustrated, one using the vCalculateBounds viewFlag, and one using a new Platforms File function to calculate paragraph heights. Using the vCalculateBounds viewFlag: There are some flaws in the current implementation of vCalculateBounds: 1. SetValue on 'text slot isn't refilling text cache (workaround: after the SetValue, do a SetValue on another slot in the clParagraphView, e.g., viewBounds) 2. paragraphview shifts down 5 pixels in your app when adding/deleting words (workaround: remove viewLineSpacing slot from clEditView and set viewFormat of clParagraphView to no lines) 3. no hilite feedback when selecting text in your app (workaround: the text really is selected, so ignore the lack of hilite) The sample code turns off gestures so hiliting is not allowed. 4. if the text is editable, scrubbing all the text can result in an exception (To create editable children of clEditViews properly, see the Notarize sample, and the Views Q&A.) Calculating the paragraph height yourself: A platforms file function called SimpleTextHeight calculates the height the specified text will occupy if displayed in a simple clParagraph view. In other words, it can be used with only a single font with no styles array or ViewLineSpacing. Note that previous versions of Wrap It Up included a now-obsolete function for calculating text height. You should use the platforms file SimpleTextHeight function instead of that function for maximum compatibility with future Newton devices. modifed Jul 6, 1994