// Table-Posteventhandler for validateField
[PostHandlerFor(tableStr(TableName), tableMethodStr(TableName, validateField))]
public static void TableName_Post_validateField(XppPrePostArgs args)
{
TableName buffTable = args.getThis();
FieldId fieldId = args.getArg("_fieldId");
boolean ret = args.getReturnValue();
//pass the return value
args.setReturnValue(ret);
}
initValue:
// Table Post eventhandler for table initvalue
[PostHandlerFor(tableStr(TableName), tableMethodStr(TableName, initValue))]
public static void TableName_Post_initValue(XppPrePostArgs args)
{
TableName buffTable = args.getThis() as TableName;
}
// Table pre-event handler for initvalue
[PreHandlerFor(tableStr(TableName), tableMethodStr(TableName, initValue))]
public static void TableName_Pre_initValue(XppPrePostArgs args)
{
TableName buffTable = args.getThis() as TableName;
}
Insert:
// Table - insert Dataeventhandler
[DataEventHandler(tableStr(TableName), DataEventType::Inserted)]
public static void TableName_onInserted(Common sender, DataEventArgs e)
{
ValidateEventArgs event = e as ValidateEventArgs;
TableName buffTable =sender as TableName;
}
Update:
// Table-Posteventhandler for update
[PostHandlerFor(tableStr(TableName), tableMethodStr(TableName, updateBackStatus))]
public static void TableName_Post_updateBackStatus(XppPrePostArgs args)
{
TableName buffTable = args.getThis();
}
ModifiedField:
// Table- pre-event handler for modified field
[PreHandlerFor(tableStr(TableName), tableMethodStr(TableName, modifiedField))]
public static void TableName_Pre_modifiedField(XppPrePostArgs args)
{
TableName buffTable = args.getThis() as TableName;
}
// Table -post-event handler for the modified field
[PostHandlerFor(tableStr(TableName), tableMethodStr(TableName, modifiedField))]
public static void TableNamee_Post_modifiedField(XppPrePostArgs args)
{
TableName buffTable = args.getThis() as TableName;
}
Datasource event handler:
Written:
// Datasource - event handler for written
[FormDataSourceEventHandler(formDataSourceStr(FormName, DataSourceName), FormDataSourceEventType::Written)]
public static void DataSourceName_OnWritten(FormDataSource sender, FormDataSourceEventArgs e)
{
FormRun form = sender.formRun();
FormDataSource DatasourceName_ds = form.dataSource(formDataSourceStr(FormName, DataSourceName)) as FormDataSource;
TableName buffTable = DatasourceName_ds.cursor();
}
initValue:
// Datasource - EventHandler for datasource initvalue
[FormDataSourceEventHandler(formDataSourceStr(FormName, DataSourceName), FormDataSourceEventType::InitValue)]
public static void DataSourceNames_OnInitValue(FormDataSource sender, FormDataSourceEventArgs e
{
FormRun formRun = sender.formRun();
FormDataSource DataSourceName_ds = formRun.dataSource(formDataSourceStr(FormName,DataSourceName)) as FormDataSource;
TableName buffTable = DataSourceName_ds.cursor();
}
Activated:
//Datasource - Event handler for data source activated method
[FormDataSourceEventHandler(formDataSourceStr(FormName, DataSourceName), FormDataSourceEventType::Activated)]
public static void DataSourceName_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
DataSourceName buffDataSource = sender.cursor();
FormDataSource DataSourceName_ds = sender.formRun().dataSource("DataSourceName");
FormRun element = sender.formRun();
}
Init:
// Datasource - event handler for data source init
[FormDataSourceEventHandler(formDataSourceStr(FormName, DataSourceName), FormDataSourceEventType::Initialized)]
public static void DataSourceName_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e)
{
FormDataSource datasourceName_ds = sender.forRun().dataSource("DataSourceName");
FormRun element = sender.formRun();
}
ValidateWrite:
// DataSource - eventhandler for datasource validatewrite
[FormDataSourceEventHandler(formDataSourceStr(FormName, DataSourceName), FormDataSourceEventType::ValidatingWrite)]
public static void DataSourceName_OnValidatingWrite(FormDataSource sender, FormDataSourceEventArgs e)
{
var datasource = sender as FormDataSource;
var args = e as FormDataSourceCancelEventArgs;
if (args != null && datasource != null)
{
// write your own logic
}
}
Form event handler:
OnInitialized:
// Form - event handler for form OnInitialize
[FormEventHandler(formStr(FormName), FormEventType::Initialized)]
public static void
FormName_OnInitialized(xFormRun sender, FormEventArgs e)
{
FormDataSource DataSourceName_ds =
sender.dataSource(formDataSourceStr(FormName, DataSourceName));
//Or
FormDataSource DataSourceName_ds
= sender.dataSource('DataSourceName');
}
Closing:
// form- event handler
for form closing
[FormEventHandler(formStr(FormName), FormEventType::Closing)]
public static void FormNamee_OnClosing(xFormRun sender, FormEventArgs e)
{
FormDataSource datasource_ds = sender.dataSource(formDataSourceStr(FormName, DataSourceName));
TableName buffTable = datasource_ds.cursor();
}
Init:
// Form - event
handler for form init.
[PostHandlerFor(formStr(FormName), formMethodStr(FormName, init))]
public static void FormName_Post_init(XppPrePostArgs _args)
{
FormRun form = _args.getThis();
FormDesign design = form.design();
FormControl variableName =
design.controlName(formControlStr(FormName, controlName));
FormControl variableName =
design.controlName(formControlStr(FormName, controlName));
}