#
CwFindFirstObject

### Syntax:

    handle = CwFindFirstObject(hSet)

            handle          (handle) The handle to an object.

            hSet            (handle) Handle to a view or group.

### Description:

This function is used to list all of the objects in the given view or group. It returns the first object in the current view or group. The first object is the one furthest back (i.e. the object that is potentially behind all other objects.)

A program can cycle through all of the objects in the given view or group by repeatedly calling CwFindNextObject with the handle returned in the previous call as the argument. The sequence of objects visited when calling CwFindNextObject in this manner is the same as the sequence of objects selected when using the page-down key.

The argument "hSet" may be either a view or a group. If it is a group, subsequent calls to CwFindNextObject or CwFindPreviousObject will return only objects in that group. If it is a view, groups will be treated as single objects.

This function behaves identically to CwFindLastObject except that the object returned is first, not last.

### Example:

    /* This function behaves exactly like CwGetObjectCount except that
       it's slower. */

    objcount:procedure
    count = 0
    o = CwFindFirstObject(CwGetCurrentView())
    do while CwIsHandleValid(o)
            count = count + 1
            o = CwFindNextObject(o)
            end
    return o

### Remarks:

+Moving or re-positioning objects between calls to CwFindFirstObject or CwFindNextObject can cause an object to be missed or returned more than once if one is not careful to consider the effect of movement on the sequence of the objects.

+Deleting objects between calls can result in strange orderings, and deleting the current object and re-using it in a call to CwNextObject will, of course, result in an error.

Functions by NAME | Index | Functions by PURPOSE