home *** CD-ROM | disk | FTP | other *** search
- /* CenterObject - Horizontally center an object with respect to the page,
- or another object.
- */
-
- row = getclickrow('Click on the object you want to center')
- col = getcolumn()
- par = getobjectat(col, row)
-
- child = par
-
- do until gettype(par) ~= 'Group'
- child = par
- par = parent(child)
- end
-
- ob1 = child
-
- if length(ob1) > 0 then do
-
- row = getclickrow('Click on the reference object (or the page)')
- col = getcolumn()
- ob2 = getobjectat(col, row)
-
-
- if length(ob2) = 0 then ob2 = ':'
-
- left = getleft(ob2) + (getwidth(ob2) - getwidth(ob1)) % 2
- top = gettop(ob1)
-
- call setposition(ob1, left, top)
-
- end
-