IsMetricYou can use the
IsMetricfunction to determine whether the current script system is using the metric system (also called the International System of Units) or the English system of measurement (also called the British imperial system). The
IsMetricfunction is also available as the
FUNCTION IsMetric: BOOLEAN;
IsMetricfunction examines the
metricSysfield of the numeric-format resource (resource type
'itl0') to determine if the current script is using the metric system. A value of 255 in the
metricSysfield indicates that the metric system (centimeters, kilometers, milligrams, degrees Celsius, and so on) is being used. In this case,
the IsMetricfunction returns a value of
TRUE. A value of 0 in the
metricSysfield indicates that the English system of measurement (inches, miles, ounces, degrees Fahrenheit, and so on) is used. In that case, the
IsMetricfunction returns a value of
If you want to use units of measurement different from that of the current script, you need to override the value of the
metricSysfield in the current numeric-format resource (resource type
'itl0'). You can do this by using your own version of the numeric-format resource instead of the current script system's default international resource.
IsMetricfunction may move or purge blocks in the heap; calling it may cause problems if you've dereferenced a handle. You should not call this function from within interrupt code, such as in a completion routine or a VBL task.
SEE ALSOFor a complete description of the international numeric-format resource (resource type
'itl0') and how to use it, see the appendix "International Resources" in Inside Macintosh: Text
For information on how to replace a script system's default international resources, see the chapter "Script Manager" in Inside Macintosh: Text.