I have 2 fields on a form, both are reals. Field1 is a value in a grid, EditField2 is an edit method in the footer of the form. The edit method has some standard AX logic that I need to execute, using the value in Field1.
The functionality I'm looking for is: When I enter a value in Field1, it populates the value in EditField2, and executes the logic in the corresponding method. Basically, I want it to act as if the same value as was entered into Field1 was entered into EditField2 and then the user hit tab or enter.
In the Modified event handler for Field1, I've done this:
[FormControlEventHandler(formControlStr(SalesReleaseOrderPicking, SalesLine_InventDeliverNow), FormControlEventType::Modified)]
public static void SalesLine_Field1_OnModified(FormControl sender, FormControlEventArgs e)
{
real lclQty;
FormRun element = sender.formRun();
FormRealControl Field1 = element.design(0).controlName("Field1");
FormRealControl EditField2 = element.design(0).controlName("Control2");
FormRun formRun = sender.formRun();
FormDataSource fds = formRun.dataSource(formDataSourceStrSalesLine
SalesLine)) as FormDataSource;
SalesLine lclSalesLine = sender.formRun().dataSource(3).cursor();
lclQty = lclSalesLine.QtyField;
if (lclQty)
{
EditField2.realValue(lclQty);
**
}
}
My question is: Where I've put "**" in the code sample, what command would simulate an Enter in EditField2, so that the edit method will execute without user intervention?
Thank you in advance!