CwMoveObjectToFront

Syntax:

call CwMoveObjectToFront hObject

        hObject         (handle) The handle referencing an object

Description:

This procedure moves the given object "hObject" to the front (i.e. in front of all other objects in the current view.)

Example:

/* Sort all objects by width (widest to the front)
   using a modified insertion sort. */

vh = CwGetCurrentView()
num = CwGetObjectCount()
do nsorted = 0 to num - 1

        obj.1 = CwFindPreviousObject(0)
        do i = 2 to num
                ndx = i - 1
                obj.i = CwFindPreviousObject(obj.ndx)
                end

        biggest = 0
        do i=num - nsorted to 1 by -1
                w1 = CwGetProperty(obj.i, "Position:width")
                if w1 > biggest then do
                        biggest = w1
                        biggestobj = i
                        end
                end
        call CwMoveObjectToFront obj.biggestobj
        call pause
        end

Remarks:

This procedure will interfere with the object-searching functions CwFindFirstObject, CwFindLastObject, CwFindNextObject, CwFindPreviousObject, CwFindDeeperObject and CwFindShallowerObject. Moving an object while listing objects with CwGet{First,Next}Object will yield unpredictable results. In the case of the CwFind functions, search order is guaranteed and based on the previous given object, so it is possible to predict whether or not they will behave as expected.

Functions by NAME

Index

Functions by PURPOSE