home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.hypercard
- Path: sparky!uunet!news.uiowa.edu!ffang
- From: ffang@newsuiowa.edu (Francis Fang)
- Subject: Re: First 80 chars?
- Sender: news@news.uiowa.edu (News)
- Message-ID: <1992Aug25.212254.6548@news.uiowa.edu>
- Date: Tue, 25 Aug 1992 21:22:54 GMT
- References: <SRO.92Aug24170044@media-lab.media.mit.edu>
- Nntp-Posting-Host: grover.printing.uiowa.edu
- Organization: University of Iowa, Iowa City, IA, USA
- X-Newsreader: Tin 1.1 PL3
- Lines: 77
-
- sro@media.mit.edu (Shawn O'Donnell) writes:
- : Hey Frank--
- : If you want to go the route of munging the field in blocks of 80
- : characters, you can do better than "char 1 to 80 of <container>". You
- :
- :
- :
- : on mouseUp
- : put empty into cd fld "destination"
- : put cd fld "source" into BufferContainer
- :
- : repeat until BufferContainer is empty
- : repeat with j = 5 to 20 -- some reasonable range for wds/line
- : if the length of BufferContainer < 80 then
- : put BufferContainer after cd fld "destination"
- : put empty into BufferContainer
- : else
- : if the length of (word 1 to j of BufferContainer) > 80 then
- : put word 1 to (j-1) of BufferContainer & return after [opt-return]
- : cd fld "destination"
- : delete word 1 to (j-1) of BufferContainer
- : exit repeat
- : end if
- : end if
- : end repeat
- : end repeat
- : end mouseUp
- :
- : This won't do all the formatting you're likely to want to have done--
- : for example, this script will miss carriage returns that you've
- : inserted for formatting. You'd have to fix all those sorts of things
- : by looking for returns in the source field. But don't bother...
- :
- : ALL OF THIS IS UNNECESSARY!! LET THE MAC DO ALL THE WORK FOR YOU.
- :
- : You can create an invisible field, set its font to Monaco, 9 pt and
- : set its width so that the maximum number of characters per line is 80.
- : Then you put the text of the real field into the invisible field, and
- : you
- :
- : repeat with j = 1 to the number of lines in fld "invisible"
- : put line j of fld "invisible" into line j of <the mini's field>
- : end repeat
- :
- : The line breaks will be at word boundaries, and any empty lines will
- : be transferred intact. If you don't mind looking at Monaco, you
- : could just set the source field to Monaco, 9 point, 80 characters
- : wide and skip the invisible field.
- :
- :
- :
- : So tell us how all of this works when you tranfer it to the mini.
- :
- : --Shawn
- :
- Hey Shawn,
-
- Thanks for the ideas. I've read your note 3 times and I'm not sure if
- you meant for me to try the first part or not (the part with the buffer
- container and all that). But I had already tried the second part (that
- with the invisible fixed pitch font field). The only problem with that
- idea was that when I put the source fld into the "invisible" fld,
- although it looks great on the screen and in the correct format (the
- lines break in the right places) when I say something to the effect of
-
- put line 1 of cd fld "invisible"
-
- Hypercard still returns the entire paragraph. Seems like I used to be
- able to say line n of the fld and have it return just the line as it is
- formatted on the screen but not anymore. Maybe some setting on my copy
- of Hypercard 2.1 is messed up.
-
- Let me know if you have any ideas as to why the above put statement
- returns the entire paragraph as opposed to just the line like what we
- want.
-
- Later.
-