FormControlEventType::Clicked
[FormControlEventHandler(formControlStr(CustOpenTrans, MarkOrderTotal), FormControlEventType::Clicked),{
FormRun formRun = sender.formRun() as FormRun;
FormRun formRunParent = formRun.args().caller();
Common originator = formRun.args().record();
FormDataSource custTransOpen_ds = formRun.dataSource('CustTransOpen');
CustTransOpen custTransOpen = custTransOpen_ds.cursor();
}
FormControlEventType::Lookup
[FormControlEventHandler(formControlStr(SalesTable, SalesLine_TruckShipmentId), FormControlEventType::Lookup),SuppressBPWarning('BPParameterNotUsed', 'Parameter required for eventhandler.')]
public static void SalesLine_TruckShipmentId_OnLookup(FormControl sender, FormControlEventArgs e)
{
SalesLine salesLine = sender.dataSourceObject().cursor();
}
FormDataSourceEventType::Activated
[FormDataSourceEventHandler(formDataSourceStr(SalesTable, SalesLine), FormDataSourceEventType::Activated),
SuppressBPWarning('BPParameterNotUsed', 'Parameter required for eventhandler.')]
public static void SalesLine_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
SalesLine salesLine;
salesLine = sender.cursor();
}
[FormDataSourceEventHandler(formDataSourceStr(SalesTable, SalesTable), FormDataSourceEventType::Activated) ]
public static void SalesTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun formRun = sender.formRun();
SalesTable saleTable;
FormDataSource salesTableDS = formRun.dataSource(formDataSourceStr(SalesTable, SalesTable)) as FormDataSource;
saleTable = salesTableDS.cursor();
}
[FormDataSourceEventHandler(formDataSourceStr(SalesTable, SalesTable), FormDataSourceEventType::Activated) ]
public static void SalesTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun formRun = sender.formRun();
SalesTable saleTable;
FormDataSource salesTableDS = formRun.dataSource(formDataSourceStr(SalesTable, SalesTable)) as FormDataSource;
saleTable = salesTableDS.cursor();
}
FormDataFieldEventType::Modified
[FormDataFieldEventHandler(formDataFieldStr(SalesTable, SalesLine, DlvMode), FormDataFieldEventType::Modified)]
public static void DlvMode_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
{
SalesLine salesLine;
salesLine = sender.datasource().cursor();
}
Form field mandatory
[FormDataFieldEventHandler(formDataFieldStr(SalesTable, FreightThirdPartyBilling, FreightBillAccount), FormDataFieldEventType::Modified) ]public static void FreightBillAccount_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
{
FormDataSource thirdPartyBillingDS;
FreightThirdPartyBilling thirdPartyBilling;
boolean allowEdit;
FormStringControl cityCtrl;
thirdPartyBillingDS = sender.datasource();
thirdPartyBilling = sender.datasource().cursor();
cityCtrl = thirdPartyBillingDS.formRun().design().controlName(formControlStr(SalesTable,FreightThirdPartyBilling_City));
cityCtrl.mandatory(allowEdit);
}
Form field modified and inserting into fields based on record.
[FormDataFieldEventHandler(formDataFieldStr(PurchTable, PurchTable, VendFactoryAddress), FormDataFieldEventType::Modified)]public static void VendFactoryAddress_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
{
LogisticsPostalAddress logisticsPostalAddress;
int64 factoryAdress;
factoryAdress = sender.getValue();
select firstonly logisticsPostalAddress where logisticsPostalAddress.RecId == factoryAdress;
sender.datasource().object(fieldNum(PurchTable, CountryRegId)).setValue(logisticsPostalAddress.CountryRegionId);
sender.datasource().object(fieldNum(PurchTable, TransactionCode)).setValue(logisticsPostalAddress.TransactionCode);
sender.datasource().object(fieldNum(PurchTable, Port)).setValue(logisticsPostalAddress.PortId);
sender.datasource().object(fieldNum(PurchTable, IntermediaryCode)).setValue(logisticsPostalAddress.IntermediaryCode);
}
Form method Post event Handler
[PostHandlerFor(formStr(SalesTable), formMethodStr(SalesTable, enableTMSFields))]
public static void SalesTable_Post_enableTMSFields(XppPrePostArgs args)
{
FormRun salesTableForm = args.getThis();
Common common = salesTableForm.args().record();
SalesTable salesTab;
FormStringControl carrierCode = salesTableForm.design(0).controlName(formControlStr(SalesTable, TMSSalesTable_CarrierCode));
FormDataSource tmsSalesTableDatasource = salesTableForm.dataSource(formDataSourceStr(SalesTable, TMSSalesTable)) as FormDataSource;
salesTab = salesTableDS.cursor();
}
public static void SalesTable_Post_enableTMSFields(XppPrePostArgs args)
{
FormRun salesTableForm = args.getThis();
Common common = salesTableForm.args().record();
SalesTable salesTab;
FormStringControl carrierCode = salesTableForm.design(0).controlName(formControlStr(SalesTable, TMSSalesTable_CarrierCode));
FormDataSource tmsSalesTableDatasource = salesTableForm.dataSource(formDataSourceStr(SalesTable, TMSSalesTable)) as FormDataSource;
salesTab = salesTableDS.cursor();
}
FormDataSourceEventType::SelectionChanged
[FormDataSourceEventHandler(formDataSourceStr(LogisticsPostalAddressGrid, DirPartyPostalAddressView), FormDataSourceEventType::SelectionChanged)]
public static void DirPartyPostalAddressView_OnSelectionChanged(FormDataSource sender, FormDataSourceEventArgs e)
{
var formRun = sender.formRun() as FormRun;
str callerFormName = formRun.args().caller().Name();
if(callerFormName == formStr(Decorator))
{
var dirPartyPostalAddDatasource = formRun.dataSource(formDataSourceStr(LogisticsPostalAddressGrid, DirPartyPostalAddressView)) as FormDataSource;
if( dirPartyPostalAddDatasource.numberOfRowsLoaded() > 0 )
{
formRun.control(FormRun.controlId(formControlStr(LogisticsPostalAddressGrid, NewAddress))).enabled(false);
formRun.control(FormRun.controlId(formControlStr(LogisticsPostalAddressGrid, MoreOptions))).enabled(false);
}
else
{
formRun.control(FormRun.controlId(formControlStr(LogisticsPostalAddressGrid, NewAddress))).enabled(true);
formRun.control(FormRun.controlId(formControlStr(LogisticsPostalAddressGrid, MoreOptions))).enabled(true);
}
}
}
public static void DirPartyPostalAddressView_OnSelectionChanged(FormDataSource sender, FormDataSourceEventArgs e)
{
var formRun = sender.formRun() as FormRun;
str callerFormName = formRun.args().caller().Name();
if(callerFormName == formStr(Decorator))
{
var dirPartyPostalAddDatasource = formRun.dataSource(formDataSourceStr(LogisticsPostalAddressGrid, DirPartyPostalAddressView)) as FormDataSource;
if( dirPartyPostalAddDatasource.numberOfRowsLoaded() > 0 )
{
formRun.control(FormRun.controlId(formControlStr(LogisticsPostalAddressGrid, NewAddress))).enabled(false);
formRun.control(FormRun.controlId(formControlStr(LogisticsPostalAddressGrid, MoreOptions))).enabled(false);
}
else
{
formRun.control(FormRun.controlId(formControlStr(LogisticsPostalAddressGrid, NewAddress))).enabled(true);
formRun.control(FormRun.controlId(formControlStr(LogisticsPostalAddressGrid, MoreOptions))).enabled(true);
}
}
}
No comments:
Post a Comment