CmpPos Script

Build 1501 on 14/Nov/2017  This topic last edited on: 11/Dec/2014, at 15:21

Description

Returns the code of the position of tested object (2) relative to referent object (1).

It is used by various automatic analysis of the mutual objects positions, e.g. to find out which frames are supposed to be moved if you change the headline height (only the frames which are below the headline are to be moved).

Syntax

result = CmpPos (hStart1,vStart1,w1,h1,hStart2,vStart2,w2,h2)

hStart1, vStart1

x- and y- position of the referent object or group of objects.

w1, h1

width  and height position of the referent object or group of objects.

hStart2, vStart2

x- and y- position of the tested object or group of objects.

w2, h2

width  and height position of the tested object or group of objects.

Returns

The function returs a coded string which describes the position of the objects. Since there are numerous positions, the string can have different number of characters. The figures list all supported return values.

The positions not shown on the graphics are: "E": the tested object precisely overlaps the referent object, and has the same dimensions. "EC": the tested object covers the entire referent object.

frfu_cmp1

frfu_cmp2

Note about the first character of the returned string: iIf the tested object does not intersect with the edges of the referent object, the first character is either L(eft), R(ight), A(bove) or B(elow). For the objects that do intersect, the first character is I. For objects which are inside, the first character is E.

Example

p = CmpPos (hStart1,vStart1,w1,h1, hStart2,vStart2,w2,h2)

If left(p,1)= "B" Or left(p,2)="IB" Then isBelow = True

The above code returns true if the tested object is below the referent object.