I found a way in which we can
override the form events like modified, lookup, clicked etc. on a Dialog.
We used to create event method on a dialog by using “FieldNumber_1_event”
format. I got a requirement in which I have to show the lookup for
service orders on the basis of project id on a dialog. I did it in a following
way instead of we used to do in Ax2009.
·
Overwrite
dialogPostRun method and wrote the following code
public void dialogPostRun(DialogRunbase _dialog)
{
FormRun formRun;
super(_dialog);
formRun =
_dialog.dialogForm().formRun();
formRun.controlMethodOverload(true);
formRun.controlMethodOverloadObject(this);
fsCtrlSmmActivityNumber =
formRun.design().control(fbsCtrlSmmActivityNumber.id());
fsCtrlProjCategoryId =
formRun.design().control(fbsCtrlProjCategoryId.id());
_dialog.dialogForm().formRun().controlMethodOverload(false);
_dialog.dialogForm().formRun().controlMethodOverloadObject(this);
//
2012-10-02 #18679 pgad: Project adjustments -->
dialogServiceOrderId.registerOverrideMethod(methodStr(FormStringControl,
lookup), methodStr(ProjAdjustmentSplit, serviceOrderLookup), this);
// 2012-10-02 #18679 pgad: Project
adjustments <-- o:p="">-->
}
·
Here I have
registered event lookup.
·
Created one
static method serviceOrderLookup.
public
void serviceOrderLookup(FormStringControl _formStringControl)
{
boolean ret;
;
ret = _formStringControl.modified();
if (ret)
{
this.lookup(); ( this will call the lookup method on a ProjAdjustmentSplit)
}
}
·
Now it will
call lookup event automatically. We need not to handle this
No comments:
Post a Comment