SetCursorPos method: Field class

Syntax

SetCursorPos(Page.page_name | %Page)

Description

The SetCursorPos method enables you to set the focus to the page field corresponding to the current Field object (on the specified page). The current page may be specified as %Page.

Parameters

Parameter Description

Page. page_name

The name of the page, preceded by the keyword Page. The page_name page must be in the current component. You can also pass the %Page system variable in this parameter (without the Page reserved word).

Returns

None.

Example

The following pseudo-code enables you to set the focus to a related field:

GetField(ControlRec.ControlField).GetRelated(RelatedRec.RelatedField).SetCursorPos⇒
(Page.pagename);

The following example places the cursor in the current field if a SaveEdit validation fails. Note the use of the %Page system variable to get the page name. Note also that SetCursorPos is called before Error.

   If None(DERIVED_SECURTY.OPERPSWD) Then
      GetField(DERIVED_SECURTY.OPERPSWD).SetCursorPos(%Page);
      Error MsgGet(48, 268, "Message Not Found");
   End-If;

Restrictions on Use with a Component Interface

This method is ignored (has no effect) when used by a PeopleCode program that’s been called by a component interface.