Dialog control field event

1. Use the info() method to info the control field's name.

 1 protected Object dialog(DialogRunbase _dialog, boolean forceOnClient)
 2 {
 3     ;
 4 
 5     dialog = super(_dialog, forceOnClient);
 6 
 7     dlg_field1 = dialog.addFieldValue(Types::String, g_Value);
 8 
 9     info(dlg_field1.name()); //The name is 'fld1_1'.
10 
11     ....
12 }

2. Add a method to active the custom event mode.

1 public void dialogPostRun(DialogRunbase _dialog)
2 {
3     ;
4 
5     super(_dialog);
6 
7     _dialog.dialogForm().formRun().controlMethodOverload(true);
8     _dialog.dialogForm().formRun().controlMethodOverloadObject(this);
9 }

3. Add a new event method, in current case we add a modified event. The event name format must be "Field name + Event name", such as 'fld1_1_modifed'.

 1 public boolean fld1_1_modified()
 2 {
 3     FormStringControl   control;
 4     boolean             ret;
 5     str                 tmp;
 6     ;
 7 
 8     control = dialog.formRun().controlCallingMethod();
 9 
10     ret = control.modified();
11 
12     if (ret)
13     {
14         if (!dlg_MailToLong.value())
15             dlg_MailToLong.value(dlg_MailTo.value());
16         else
17         {
18             tmp = dlg_MailToLong.value() + "," + dlg_MailTo.value();
19             dlg_MailToLong.value(tmp);
20         }
21 
22         dlg_MailTo.value("");
23     }
24 
25     return ret;
26 }
原文地址:https://www.cnblogs.com/Jinnchu/p/2768173.html