Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!ubc-vision!alberta!calgary!freedman From: freedman@calgary.UUCP (Dan Freedman) Newsgroups: comp.sys.mac Subject: Re: Yet another HC bug? Message-ID: <1103@vaxb.calgary.UUCP> Date: Tue, 6-Oct-87 20:01:45 EDT Article-I.D.: vaxb.1103 Posted: Tue Oct 6 20:01:45 1987 Date-Received: Sun, 11-Oct-87 00:48:47 EDT References: <130STORKEL@RICE> Organization: U. of Calgary, Calgary, Ab. Lines: 53 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