STORKEL@RICE.BITNET (Scott Storkel) (10/05/87)
Does anyone know the status of the Hypercard global property numberFormat? This property is listed in the HC manual (working draft 3), but doesn't seem to be working. I have two fields on two different cards, one with the value 3.00 the other with the value 1.00. On openstack I do a set numberFormat to 00.00. However when I do "add A to B; put a into message", wherre A is 3.00 and B is 1.00, the answer is 4, NOT 4.00. What gives? Is this property still supposed to work? Has it been renames? Is is yet another Hypercard bug? Obviously I can write a clumsy function the formats everything the way I want it, but it would sure be nice if this property worked as advertised. Anyone got any info? Thanks, Scott Storkel Macintosh Software Development Rice University (STORKEL@RICE.BITNET) Disclaimer: In this moment of the NOW that I myself believe to be the truth, and have created for this lifetime, my employers are not responsible for the thought/actions that I produce.
freedman@calgary.UUCP (Dan Freedman) (10/07/87)
In article <130STORKEL@RICE>, STORKEL@RICE.BITNET (Scott Storkel) writes: > Does anyone know the status of the Hypercard global property numberFormat? This > property is listed in the HC manual (working draft 3), but doesn't seem to be > working. > I have two fields on two different cards, one with the value 3.00 the other > with the value 1.00. On openstack I do a set numberFormat to 00.00. However > when I do "add A to B; put a into message", wherre A is 3.00 and B is 1.00, the > answer is 4, NOT 4.00. What gives? Is this property still supposed to work? Has > it been renames? Is is yet another Hypercard bug? The numberFormat global property is a bit weird in that it even if you change it, it returns to its default setting whenever HyperCard sends an Idle message. Idle messages get sent when nothing else is happening, ie: whenever scripts are not running. So, setting the numberFormat when the stack is opened is not good enough, since once the openStack handler finishes running, it will return to its default value. What you need to do is set it during each script that changes any numbers you are interested in having formatted. One more wrinkle: the change only takes effect after you do an arithmetic calculation, so (as Goodman points out) you may have to include a dummy calculation in your script. The following should illustrate how it works: 1) No formatting, works fine: on mouseUp put 3 into field "Number" end mouseUp 2) We try to format it as "3.00", but it doesn't work: on mouseUp set numberFormat to 0.00 put 3 into field "Number" end mouseUp 3) Finally, we get it right on mouseUp set numberFormat to 0.00 put 3 + 0 into field "Number" end mouseUp If you ask me, this is a very weak facility, and should be changed. Each field should have its own numberFormat property, settable at the "Field Info..." dialog. The way it is now is very poor. I would not object so much if hypercard scripts ran quickly, but as it is now, including additional statements and calculations slows things down enough to make one think twice about formatting numbers at all. Dan Freedman University of Calgary Computer Science Department
gardner@prls.UUCP (Robert Gardner) (10/09/87)
In article <1103@vaxb.calgary.UUCP> freedman@calgary.UUCP (Dan Freedman) writes: >I would not object so much if hypercard scripts ran quickly What are the issues involved with producing a HyperCard compiler? I understand SmallTalk can now be compiled so I would think HyperCard could, also. Is Apple working on such a beastie? Robert Gardner
roberts@cognos.uucp (Robert Stanley) (10/13/87)
In article <130STORKEL@RICE> STORKEL@RICE.BITNET (Scott Storkel) writes: >Does anyone know the status of the Hypercard global property numberFormat? This >property is listed in the HC manual (working draft 3), but doesn't seem to be >working. There is a nasty little weasel statement somewhere that reads (from memory): "Because numberFormat can change the answers that all arithmetic gives, it is reset to the default whenever HyperCard is idle" Make of this what you will (I have never bothered to track this one all the way to its lair), but it surely looks like the reason for your problem. Perhaps you can stop HyperCard deciding it is idle by using a lock in the script, but it surely looks like numberFormat can be set to a new value only within the scope of a single script. Comments, anyone? -- Robert Stanley Cognos Incorporated S-mail: P.O. Box 9707 Voice: (613) 738-1440 (Research: there are 2!) 3755 Riverside Drive FAX: (613) 738-0002 Compuserve: 76174,3024 Ottawa, Ontario uucp: decvax!utzoo!dciem!nrcaer!cognos!roberts CANADA K1G 3Z4