mardi 18 septembre 2012

Overriding method for a control in dialog (RunBase framework)

Scenario:Can we have an overridden method in a dialog class. I can not use form as a dialog. I have to add a method in the dialog class. Like modified method of an EDT.

Answer:Well it can be done. First you have to add a method dialogPostRun

public void dialogPostRun(DialogRunbase dialog)
{
;
dialog.dialogForm().formRun().controlMethodOverload(true);
dialog.dialogForm().formRun().controlMethodOverloadObject(this);
dialog.formRun().controlMethodOverload(true);
dialog.formRun().controlMethodOverloadObject(this);
super(dialog);
}

This method actually allows the dialog form to override control method at runtime. Now we need the name of the control at runtine that needs the overriden method. You can get that using

print dialogCustId.name();
pause;

where dialogCustId is the EDT. let say the name returned at runtime is Fld3_1.


Now if you have to override lookup method of the EDT you can write the method like this

void Fld3_1_lookup()
{
//override lookup method here
}

If you need to override modified method

boolean Fld3_1_modified()
{
}

.
The modified method can also be accessed by overriding

public void dialogSelectCtrl()
{
}

in the runbase class. Just call

dialog.allowUpdateOnSelectCtrl(true);

in the dialog method.

You can also create a dialog form and pass it as the parameter in the dialog method of runbase class. you can find an example in tutorial_runbase class and form.

Aucun commentaire:

Enregistrer un commentaire