vcUnitFamily

vcUnitFamily is a collection of units that belong to the same system of measurements. This unit family concept is not a strict definition rather a way to simplify unit selection

Usage

A unit family contains any number of unit groups, which are collections of related units. When a unit family is selected, each of its unit groups become the current groups for quantities. This eliminates the need to manually change each quantity when changing the active unit family of application as well as preserving selected units in quantities.

Properties

Name Type Access Description
Groups List of vcUnitGroup R Gets a list of all unit groups in unit family.
IsBuiltIn Boolean R Indicates if unit family is a built-in type.

If True, adding and removing custom unit groups from unit family is allowed but not for built-in unit groups.

Name String RW/R If unit family is built-in, gets the unit family's name; otherwise defines the name of unit family which cannot contain any dot (.) characters.

Methods

Name Return Type Parameters Description
addGroup Integer vcUnitGroup group

or

String groupName

Adds a given unit group or one matching a given name to unit family, and then returns the index of unit group in unit family.
containsGroup Boolean vcUnitGroup group

or

String groupName

Returns True if a given unit group or one matching a given name is in the unit family; otherwise returns False.
removeGroup Boolean vcUnitGroup group

or

String groupName

Removes a given unit group or one matching a given name from unit family.

Returns True if removal is successful; otherwise returns False if name does not match a unit group or throws an exception if unit group is built-in.

removeGroupAt None Integer index Removes a unit group at a given index from unit family.

This method throws an exception if unit group is built-in.