Folded Integer Type

The DataFlex folded integer type is a "packed" integer that stores two integer values. In older revisions of DataFlex, this type was referred to as a complex integer.

DataFlex integers have a storage capacity of 32 binary bits (4-bytes). Using the Hi and Low functions, a single integer can be used to encode two 16-bit (2-byte) values each. The value of the upper 16 bits of an integer can be retrieved via the Hi function. The value of the lower 16 bits of an integer can be retrieved via the Low function.

This type is typically used only for properties that store X and Y positions of an object, such as Size and Location.

The Studio can represent folded integer properties in the Object Properties window as a Folded property.

Reading and Writing Folded Integer Properties

When a folded integer property is written to, two integer parameters are passed, a hi and low value. When the value of the property is retrieved, the value of these two properties is returned as a folded integer.

Reading Folded Integer Properties

A folded integer property is read (get) as follows:

Integer iValue iHiValue iLowValue

 

Get Size to iValue

Move (Hi(iValue)) to iHiValue

Move (Low(iValue)) to iLowValue

Writing Folded Integer Properties

A folded integer property is written to (set) as follows:

Set PropertyName to iHiValue iLowValue

Example

For example, the Size property is accessed as follows:

A folded integer property is written (set) as follows:

Set Size to iHeight iWidth

A folded integer property is read (get) as follows:

Get Size to iValue

Move (Hi(iValue)) to iHeight

Move (Low(iValue)) to iWidth