GenValue: 4.4 Supplemental Usage: Using Value Ratios

Up: GEOS SDK TechDocs | Up | Prev: 4.3 Retrieving Text | Next: 4.5 Text Filters for the GenValue
MSG_GEN_VALUE_GET_VALUE_RATIO, MSG_GEN_VALUE_SET_VALUE_FROM_RATIO

Instead of setting or getting a specific value, you may want in some cases to set or get a value as a ratio; this ratio is determined as the percentage of the difference between the minimum and maximum. For example, if the minimum of a GenValue is 10 and the maximum is 100, the 50% ratio would be 55 (halfway between 10 and 100).

To retrieve the value of a GenValue as a ratio, send it MSG_GEN_VALUE_GET_VALUE_RATIO . This message will return the ratio as a dword value. You must also pass this message the GenValueType telling it which instance data you wish to retrieve.

To set a value within a GenValue as a ratio, send it MSG_GEN_VALUE_SET_VALUE_RATIO , passing it the ratio and the GenValueType (instance data field) to set. The correct value will be computed and set within your GenValue's instance data.

MSG_GEN_VALUE_GET_VALUE_RATIO

WWFixedAsDWord MSG_GEN_VALUE_GET_VALUE_RATIO(
        GenValueType		valueType);

This message gets the value of a GenValue (GVLI_ value ) as a ratio of its distance between the minimum value and the maximum value. It returns this ratio as a dword (0000.0000h meaning 0%, ffff.ffffh meaning 100%).

Source: Unrestricted.

Destination: Any GenValue object.

Parameters: valueType GenValueType of the instance data field to get the value ratio for.

Return: The ratio as a dword.

Interception: You may intercept subclasses of GenValueClass to allow custom text formats to be displayed on the screen. Someone subclassing this message for this reason would also want to subclass MSG_GEN_VALUE_SET_VALUE_FROM_TEXT to correctly parse text to yield a new value.

MSG_GEN_VALUE_SET_VALUE_RATIO

void	MSG_GEN_VALUE_SET_VALUE_RATIO(
        WWFixed		ratio,
        GenValueType		valueType);

This message sets the value (GVLI_ value ) of a GenValue as a ratio of the distance between its minimum and the maximum values. This ratio should be in the form of a dword (0000.0000h meaning 0%, ffff.ffffh meaning 100%).

Source: Unrestricted.

Destination: Any GenValue object.

Parameters: ratio The dword ratio value.

valueType
The GenValueType of the instance data to set as a ratio.

Return: Nothing.

Interception: Generally not intercepted.


Up: GEOS SDK TechDocs | Up | Prev: 4.3 Retrieving Text | Next: 4.5 Text Filters for the GenValue