This can be used as a copy-paste pattern, when you need to change a standard method for new form controls added as a form extensions.
At the form initialization step we can overload any form control methods with registerOverrideMethod.[ExtensionOf(formStr(<FormName>))] public final class my<FormName>_MyNewButton_Extension { public void init() { next init(); // MyNewButton button added in an extension to <FormName> FormButtonControl myButton = this.design().controlName(formControlStr(<FormName>, myNewButton)); // Here we can overload its standard clicked() method in run-time myButton.registerOverrideMethod(methodStr(FormButtonControl, clicked), formMethodStr(<FormName>, myNewButtonClicked), this); } public void myNewButtonClicked(FormButtonControl _sender) { <run some logic> _sender.clicked(); } }
Check this article for more complicated scenario https://alexvoy.blogspot.com/2018/09/lookup-and-modified-methods-for.html
No comments:
Post a Comment