kenk@tellab5.tellabs.CHI.IL.US (Ken Konecki) (02/14/89)
(Apologies if this has been sent, but I have received no replies, so I assume our machine is not co-operating) Hello everybody, I'm in the process of setting up a recipes stack for my wife and I've had to create a scrolling field for the directions part of the recipes. The only trouble is that when you select print card from the menu, it does a dump of the screen image, so you lose the full contents of the field. Is there a way to print the card and have the full contents of the scrolling field visible? Please e-mail to me (...!uunet!tellab5!kenk) with any replies, since our news machine is too slow to read any news in a finite amount of time. Thanks a billion, -Ken K -- Ken Konecki ...!uunet!tellab5!kenk -or- kenk@tellab5.CHI.IL.US "A squeegee by any other name wouldn't sound as funny"
HKR@PSUVM.BITNET (Ken Rosenberry) (02/21/89)
In article kenk@tellab5.tellabs.CHI.IL.US (Ken Konecki) says: >I'm in the process of setting up a recipes stack for my wife >and I've had to create a scrolling field for the directions >part of the recipes. The only trouble is that when you select print >card from the menu, it does a dump of the screen image, so you lose >the full contents of the field. Is there a way to print the card >and have the full contents of the scrolling field visible? ------- Here is a script that might help. It prints multiple cards with identical information on each card, except that the contents of the scrolling field advances with each card. The "PrintMe" subroutine isn't pretty but it does work. Part of the complexity is due to the fact that HyperCard doesn't have a built-in function to report how many lines are in the field (unless each line contains a return character). I had poor results using this routine when the point size of the scrolling field (from top to bottom) wasn't an even multiple of the point size of the TextHeight. So, I've included a small script for the field that will report it's size if you click on the field with the command key down. That script is in no way essential to the script that actually prints the cards. Also, note that the "PrintMe" routine uses a bkgnd field "Fscreens" that is either null (if the scrolling field contains only one window of text) or contains the string "Card x of x" (if the scrolling field contains more than one window of text). It's nice if you're printing the entire stack and wish to quickly glance at the output and identify unique cards. Here are the scripts; good luck! -- -- Script of the scrolling field follows: -- on MouseDown -- -- Command-click the field to determine if this field's height -- (in points) is evenly divisible by the point size of the -- field's text. -- get the rectangle of bkgnd field "ThisField" put item 2 of it into Top put item 4 of it into Bottom put Bottom - Top - 2 into FHeight put the textheight of bkgnd field "ThisField" into LHeight put "FieldHeight=" & FHeight && " LineHeight=" & LHeight into Message put FHeight mod LHeight into OverSize if OverSize = 0 then put Message && " Scrolling field is perfect size!" else put Message && " Scrolling field is +" & OverSize && "or -": & LHeight-OverSize && "pixels off." end MouseDown -- -- Script of the print button follows: -- on MouseUp go to card 1 open printing with dialog repeat for the number of cards PrintMe go to next card end repeat close printing end MouseUp on PrintMe -- -- Tested with HyperCard 1.2.1 -- -- This script works well if: -- the size of the scrolling field (in points, top to bottom) -- is evenly divisible by the point size of the field's text. -- -- Note: If your scrolling field contains a return character on each -- line, you can calculate some of the field info using native -- HyperCard functions rather than the following kludgy code. -- get the rectangle of bkgnd field "ThisField" put item 1 of it into Left put item 2 of it into Top put item 3 of it into Right put item 4 of it into Bottom -- -- Calculate info about the scrolling field -- -- FPoints = number of points (top to bottom) of the field put Bottom - Top - 2 into FPoints -- LHeight = point size of each line of the field put the textheight of bkgnd field "ThisField" into LHeight -- FLines = number of lines in one screen of the field put FPoints/LHeight into FLines -- FLinesTot = number of lines in the entire field set scroll of bkgnd field "ThisField" to 32000 -- scroll text past end click at Right-5,Top+5 -- now field shows the last screenfull of text get scroll of bkgnd field "ThisField" put (it + FPoints) / LHeight into FLinesTot -- FScreens = number of screens in the entire field put 1 + trunc((FLinesTot-1)/(FLines)) into FScreens -- -- print each screen full of the scrolling field's text -- repeat with i = 1 to FScreens set scroll of bkgnd field "ThisField" to (i-1)*LHeight*FLinesTot if FScreens = 1 then put empty into bkgnd field "FScreens" else put "Card " && i && " of " && FScreens into bkgnd field "FScreens" end if print this card put empty into bkgnd field "FScreens" set scroll of bkgnd field "ThisField" to 0 end repeat end PrintMe ------- Ken Rosenberry phone: 814-865-4763 Pennsylvania State University BITNET: hkr at psuvm 137 Computer Building APPLELINK: u0485 University Park, PA 16801 UUCP: !ihnp4!psuvax1!psuvm.BITNET!hkr