Salesforce

How Do I Make the Cursor Jump to a Specific Control? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Make the Cursor Jump to a Specific Control? (Magic xpa 4.x)

Sometimes you may want to make the cursor jump to a particular control. For instance, when an error message is given, you may want to jump to the field in error, or you may want to skip fields that the user doesn’t ordinarily use when the screen is first presented.

You can make the cursor jump to any control at runtime, by using the CtrlGoto() function. The syntax is as follows:

CtrlGoto(‘Control name’, row, generation)

‘Control name’

The control name, as a string, in quotes.

row

In tabular data, this refers to the line number.

generation

The task’s hierarchic position in the runtime task tree. The current task is Task 0. Task 1 would switch focus to the parent task.

Using CtrlGoto()


  1. Go to the logic unit that will execute the cursor jump. In this case, we are using Record Prefix, because we want the cursor to jump to Phone Number when the user first enters the record.

  2. Press F4 to add an operation line.

  3. Type A to select Evaluate Expression. The cursor will jump to the Expression field.

  4. Press F5 or double-click to zoom to the Expression Rules.

  5. Press F4 to open up a line. Type

    CtrlGoto(

    or type Ct and press Ctrl+Spacebar to use the Auto complete feature.

  6. From the right-click menu, select Controls to select the control you want, or type in the control name.

  7. For most tasks, you will use 0,0 for the last two parameters, which means we don’t have a table and we are jumping to a control in this task.

    If, however, you are using a table, then the first number would be the line number to jump to. For instance,
    CtrlGoto ('Phone_Number',3,0) would move the cursor to the phone number field on the 3rd line down in the table.

    If you are jumping to a parent task, then you would use 1 for the second number, or 2 for the grandparent, etc.
    CtrlGoto ('Phone_Number',0,1)would move the cursor to the phone number field in the parent task.

See also

The Online and Rich Client Samples projects (program LG10 and RLG10)

Reference
Attachment 
Attachment