在我的第一个事件处理程序中,我将从 SalesTable 表单中收集我需要的所有字段。在这种形式中,我需要从 SalesLine 获取这些字段。以下是我的代码:
[FormEventHandler(formStr(SalesTable), FormEventType::PostRun)]
public static void SalesTable_OnPostRun(xFormRun sender, FormEventArgs e)
{
SalesLine salesLine;
SalesTable salesTable = sender.dataSource(formDataSourceStr(SalesTable,salesTable)).cursor();
select ItemId, SalesId, ShippingDateConfirmed from salesLine
where salesLine.SalesId == SalesTable.SalesId;
}
之后,下一个事件处理程序是在另一个表单中找到的按钮的 OnClick 事件..
[FormControlEventHandler(formControlStr(SalesAvailableDlvDates, TransferToConfirmedButton), FormControlEventType::Clicked)]
public static void TransferToConfirmedButton_OnClicked(FormControl sender, FormControlEventArgs e)
{
//some code here
}
在此 SalesAvailableDlvDates 的不同表单的事件处理程序中,我需要从 SalesLine表 中获取的字段 SalesTable 表单。因为在这里,这是需要触发的按钮,这将把值放入新创建的表中。
我是否可以将 SalesTable事件处理程序中的值传递给 SalesAvailableDlvDates事件处理程序?
因为在SalesAvailableDlvDates中,我无法获取SalesLine数据。是否可以将值从一个事件处理程序传递到另一个事件处理程序?
答案 0 :(得分:1)
在SalesAvailableDlvDates
表单事件处理程序中,您可以获取表单调用方。然后,如果salesCalcAvailableDlvDates
是SalesCalcAvailableDlvDates_SalesTable
或SalesCalcAvailableDlvDates_SalesLine
,您可以从相应的parm
方法获取所需的数据。
[FormControlEventHandler(formControlStr(SalesAvailableDlvDates, TransferToConfirmedButton), FormControlEventType::Clicked)]
public static void TransferToConfirmedButton_OnClicked(FormControl sender, FormControlEventArgs e)
{
SalesTable salesTable;
SalesLine salesLine;
SalesCalcAvailableDlvDates salesCalcAvailableDlvDates;
SalesCalcAvailableDlvDates_SalesLine salesCalcAvailableDlvDates_SalesLine;
SalesCalcAvailableDlvDates_SalesTable salesCalcAvailableDlvDates_SalesTable;
FormRun formRun;
;
formRun = sender.formRun() as FormRun;
salesCalcAvailableDlvDates = formRun.args().caller();
switch (classIdGet(salesCalcAvailableDlvDates))
{
case classNum(SalesCalcAvailableDlvDates_SalesLine):
salesCalcAvailableDlvDates_SalesLine = salesCalcAvailableDlvDates as SalesCalcAvailableDlvDates_SalesLine;
salesLine = salesCalcAvailableDlvDates_SalesLine.parmSalesLine();
salesTable = salesLine.salesTable();
break;
case classNum(SalesCalcAvailableDlvDates_SalesTable):
salesCalcAvailableDlvDates_SalesTable = salesCalcAvailableDlvDates as salesCalcAvailableDlvDates_SalesTable;
salesTable = salesCalcAvailableDlvDates_SalesTable.parmSalesTable();
break;
default:
break;
}
}