strange Addon behaviour created with B1 Studio
We found a simple and strange behaviour of AddOns created with B1 Studio during our development, and we believe it might be an AddOn platform bug:
Create a new AddOn with B1 Studio (C# or VB), and add 2 EditText fields to default form.
In EditText0 field, activate the ValidateAfterEvent and add this simple code:
static int total = 0;
private void EditText0_ValidateAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
EditText1.Value = total.ToString();
Run addon, enter any text on EditText0 field and press tab: at this moment the AddOn and SAP B1 should block completely.
If we debug it, we realize that the text assignment to EditText1 field generates a ValidateAfter event on EditText0 and the program enters a recursive loop. We believe this should never happen since its another EditText field that's being changed, so its quite possible a bug in the AddOn platform.
Although this problem does not occur if we assign UserDataSources to the fields and assign text through them, the direct text assignment to text fields should avoid this recursive problem...
We are using SAP 9.1 PL04 x86, with VS2013 Professional,
Is there any other explanation for this behaviour?
Maik Delly replied
this is not really a problem, but a classic programing problem.
Whenever you do EditText1.Value = total.ToString(); another validation of EdiText0 is triggered this results in an infinite loop. This is due to that the validation is an encapsuled event.
So from my perspective it is not a bug but something you should take care of when coding.