Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Retrieves a FormControl object for the field that precedes the field that is specified by a FormControl object.
Syntax
public FormControl getPrevField(FormControl control, [int flags])
Run On
Client
Parameters
- control
Type: FormControl Class
A FormControl object for a specified field.
- flags
Type: int
An integer that specifies the process that is used to find the last field; optional.
Return Value
Type: FormControl Class
A FormControl object.
Remarks
You can use one or more of the following bit-flag constants for the _flags parameter. You can use macros to define constants. For more information, see Macros in X++.
FINDCONTROL_CANEDIT= 0x0001
FINDCONTROL_CONTAINER= 0x0002
FINDCONTROL_CANDISPLAY= 0x0004
FINDCONTROL_SAMECONTAINER= 0x0008
FINDCONTROL_NODISPLAYTEST= 0x0010
FINDCONTROL_TABSTOP= 0x002
FINDCONTROL_SAMEPARENTCONTAINER= 0x0040
FINDCONTROL_ALLOWSYSHIDDEN= 0x0080
FINDCONTROL_SINGLELOOP= 0x0100
FINDCONTROL_NOTPARENTCONTAINTER= 0x0200
FINDCONTROL_ACTIVE= 0x0400
FINDCONTROL_VISIBLE= 0x0800
FINDCONTROL_SAMECONTROLTYPE= 0x1000
Examples
The following example shows a call to the getPrevField method to return a FormControl object for the previous field in the form. The FormControl.helpText method sets the Help text for the previous field.
static void createForm2(Args _args)
{
Args args;
Form form;
FormRun formRun;
FormBuildDesign formBuildDesign;
FormBuildDataSource formBuildDataSource;
FormBuildGridControl formBuildGridControl;
FormBuildStringControl formBuildStringControl;
FormStringControl formStringControl;
FormControl formControl;
DictTable dictTable;
int idx;
int idx2;
// Create the form header.
form = new Form();
// Add data sources to the form.
dictTable = new DictTable(tablenum(CustTable));
formBuildDataSource = form.addDataSource(dictTable.name());
formBuildDataSource.table(dictTable.id());
// Create the form design.
formBuildDesign = form.addDesign("Design");
// Add controls.
formBuildGridControl =
formBuildDesign.addControl(FormControlType::Grid, "Table Grid");
formBuildGridControl.dataSource(dictTable.name());
idx = formBuildGridControl.id();
formBuildStringControl =
formBuildDesign.addControl(FormControlType::String, "Table String");
formBuildStringControl.dataSource(dictTable.name());
idx2 = formBuildStringControl.id();
// Add a data field to the controls.
formBuildGridControl.addDataField(formBuildDataSource.id(),
dictTable.fieldName2Id("AccountNum"));
formBuildStringControl.dataField(1);
args = new Args();
args.object(form);
// Create the run-time form.
formRun = new FormRun(Args);
formRun.run();
formRun.detach();
formStringControl = formRun.control(idx2);
formControl = formRun.getPrevField(formStringControl);
formControl.helpText("This field displays a table record.");
}