### IContainerControl::TextCursor

  The IContainerControl::TextCursor class iterates through the container and finds objects containing a specified text string. You specify this text string when creating the IContainerControl::TextCursor object.

### IContainerControl::TextCursor - Member Functions and Data by Group

### Constructors & Destructor

You can construct and destruct objects of this class.

~TextCursor

      public:
      virtual ~TextCursor()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

TextCursor

      public:
      TextCursor( const IContainerControl& container,
                  const char* text,
                  bool isCaseSensitive = true,
                  bool isFirstInRecord = false,
                  bool isExactMatch = false )

  Constructs objects of this class by specifying a text string to search the container for. Optionally, you can specify that the search return any of the following:

  - A case-sensitive match only
  - A match only when the text is the first in the record
  - An exact match of the text string only

  When you construct a TextCursor, it is only valid for the objects shown in the currently displayed container view. For example, if you construct a TextCursor while the container is displaying the icon view and you want the application to iterate a TextCursor for children in a tree view, you must do the following:

  - Switch the container to the tree view
  - Create a new TextCursor

  If you create a details view TextCursor, it searches all the text columns for the specified string.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Cursor Movement

Use these members to position the text cursor.

setToFirst

      public:
      virtual bool setToFirst()

  Points to the first object in the container with the matching text. If there are no objects in the container, false is returned. This function validates a cursor that was set not valid as a result of adding or removing objects from the container.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setToLast

      public:
      virtual bool setToLast()

  Points to the last object in the container with the matching text. If there is a last object, true is returned. Otherwise, false is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setToNext

      public:
      virtual bool setToNext()

  Points to the next or first object in the container with the matching text. If the cursor does not point to an object, this function is the same as setToFirst. The cursor does not point to an object when it is initially created. In other words, setToNext on a new cursor is the same as setToFirst.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setToPrevious

      public:
      virtual bool setToPrevious()

  Points to the previous or last object in the container.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Cursor Validation

Use these members to validate the cursor.

invalidate

      public:
      virtual TextCursor& invalidate()

  Flags the cursor as not valid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isValid

      public:
      virtual bool isValid() const

  Queries whether the cursor is pointing to a valid object. The cursor is not valid if any of the following occur:

  - You add a column after you created the cursor.
  - You remove a column after you created the cursor.
  - The last operation on the cursor put it into an undefined state.
  For example, calling setToNext when the cursor is pointing to the last object in the container causes the cursor to be not valid.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

AIX Considerations

  The AIX release does not support this attribute because AIX does not support the ICnrDrawHandler.

### Object Retrieval

Use these members to retrieve objects using a text cursor.

current

      public:
      virtual IContainerObject* current() const

  Returns the current object of this cursor.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

first

      public:
      virtual IContainerObject* first()

  Points to and returns the first object in the container with the matching text. If there are no objects in the container, 0 is returned. This function validates a cursor that was set invalid as a result of adding or removing columns from the container.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

last

      public:
      virtual IContainerObject* last()

  Points to and returns the last object in the container with matching text. Returns 0 if there is no object in the container. This function validates a cursor that was set invalid as a result of adding or removing an object from the container.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

next

      public:
      virtual IContainerObject* next()

  Points to and returns the next or first object in the container with the matching text. If the cursor has reached the end of the list of objects in the container, 0 is returned.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

previous

      public:
      virtual IContainerObject* previous()

  Points to and returns the previous or last object in the container with the matching text.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

setCurrent

      public:
      virtual TextCursor&
        setCurrent( const IContainerObject* currentObject )

  Sets the cursor to point to the specified object.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### IContainerControl::TextCursor - Inherited Member Functions and Data

#### Inherited Public Functions

  - None

#### Inherited Public Data

  - None

#### Inherited Protected Functions

  - None

#### Inherited Protected Data

  - None