Wednesday, July 12, 2023

Event Handlers

 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();
    }


Datasource event handler:

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;
                                //(or)
        FormDataSource   DataSourceName_ds = send as formdatasource  ;  
        TableName        buffTable           = DataSourceName_ds.cursor();
    }


DataSource field Level 

Modified

[FormDataFieldEventHandler(formDataFieldStr(HcmWorkerEnrollment, HcmWorkerEnrolledBenefit,   Benefit), FormDataFieldEventType::Modified)]
 public static void Benefit_OnModified(FormDataObject sender, FormDataFieldEventArgs e)
 {
     FormDataSource   fd      = sender.datasource();
     table            buffer  = fd.cursor();
     FormRun         formRun  = fd.formRun();

    FormRealControl     amount = formRun.design().controlNam('ControlName');
        
}

Form Control 
Clicked ()

[FormControlEventHandler(formControlStr(HcmWorkerEnrollment, ControlName), FormControlEventType::Clicked)]
public static void Controlname_OnClicked(FormControl sender, FormControlEventArgs e)
{
FormRun  formRun = sender.formRun();
        FormDataSource   FormDataSource_ds = formRun.dataSource(formDataSourceStr(HcmWorkerEnrollment,                   DataSourceName));
        Table  Buffer = FormDataSource_ds.cursor();
}

No comments:

Post a Comment

adding new node in hierarcy type in workflow

class: WorkflowHierarchyProviderHelper  for convert nodetype  [ExtensionOf(classstr(WorkflowHierarchyProviderHelper))] public  final class ...