Skip to Content
0
Former Member
Jun 16, 2011 at 02:37 PM

Crash after clicking on Matrix row in 8.81

15 Views

Hello,

I have written an addon and it was working well in SBO 2007, but it had to work also in 8.81, that's where I encountered the problem.

The addon basicly adds two matrices to the system form of Purchase Order. The matrices were filled using DataTables. First problem was SBO 8.81 crash when I added more then one DataTable to the form. The crash was occuring when filling the second matrix with data (didn't matter if it was using matrix.LoadFromDataSource() or matrix.AddRow()), but this could be easily overpassed using UserDataSources instead of DataTable.

But later I encountered error that I cannot fix. SBO 8.81 crashes when I add a matrix to the form Purchase Order form, add a row to the matrix and then the user clicks on the row to fill it with data. A sample code that causes the crash is below:

void SBO_Application_FormDataEvent(ref BusinessObjectInfo BusinessObjectInfo, out bool BubbleEvent)
        {
            BubbleEvent = true;
            if (BusinessObjectInfo.EventType == BoEventTypes.et_FORM_DATA_LOAD && !BusinessObjectInfo.BeforeAction &&
                BusinessObjectInfo.FormTypeEx == "142")
            {
                Form form = SBO_Application.Forms.GetFormByTypeAndCount(142, 0);
                Item ma = form.Items.Add("TMP", BoFormItemTypes.it_MATRIX);
                ma.Left = 210;
                ma.Top = 150;
                ma.Width = 300;
                ma.Height = 300;
                Matrix mat = (Matrix)ma.Specific;
                mat.Columns.Add("TMPCOL", BoFormItemTypes.it_EDIT);
                mat.AddRow(1, mat.RowCount);
            }
        }

In SBO, navigate to Purchase Order, switch to an existing document, and click on the first row of user matrix. It works fine in 2007 but crashes in 8.81. I tested it on two machines, two different environments with 8.81, and the crash occured on both.

Did anyone experienced same behavior? Is there any workaround?