Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!jkc From: jkc@Apple.COM (John Kevin Calhoun) Newsgroups: comp.sys.mac.hypercard Subject: Re: Help putting sum of field in another Message-ID: <47856@apple.Apple.COM> Date: 8 Jan 91 04:54:32 GMT References: <1991Jan8.005708.5908@macc.wisc.edu> Distribution: na Organization: Apple Computer Inc., Cupertino, CA Lines: 52 In article <1991Jan8.005708.5908@macc.wisc.edu> jbnash@vms.macc.wisc.edu (John B. Nash) writes: [ A question about summing the contents of a background field from each card of the background, and putting the new total into a background field on each card of the background. ] Here's how I would do this in HyperCard 2.0: >on mouseUp -- I removed a line here > put zero into total -- initialize variable lock screen -- optional step push card -- remember where we started > repeat with i = 1 to the number of cards in bg id 2763 go to card i of bg id 2763 -- crucial step > add bg field "VALUE" to total -- I removed a line here. > end repeat pop card -- go back where we started put total into field "CUMULATIVE" unlock screen -- only if you locked the screen, above >end mouseUp This works if the sharedText of field "CUMULATIVE" is true. In version 1.x, I would do it like this, because there's no sharedText property for background fields: >on mouseUp -- I removed a line here > put zero into total -- initialize variable lock screen -- optional step push card -- remember where we started > repeat with i = 1 to the number of cards in bg id 2763 go to card i of bg id 2763 -- crucial step > add bg field "VALUE" to total -- I removed a line here. > end repeat repeat with i = 1 to the number of cards in bg id 2763 go to card i of bg id 2763 put total into field "CUMULATIVE" -- I removed a line here. end repeat pop card -- go back where we started unlock screen -- only if you locked the screen, above >end mouseUp Kevin Calhoun HyperCard Team Apple Computer, Inc.