cancel
Showing results for 
Search instead for 
Did you mean: 

Handle multiple rows selection on Matrix

cesidio_ludovisi
Explorer
0 Kudos

Hi all,

i'd like to know if someone could help me with multiple selections on matrix via shift + left mouse button on a matrix.

I got a matrix with one column containing a checkbox for selection. The matrix, on a UDO Form, is defined as auto selecting, so multiple selection of rows is allowed.

I want to add the rows selected by the checkbox (using shift + left mouse button on the selection start and selection end) column to the matrix selected rows collection.

Is there any chance to catch an event handling this situation?

I can add the rows in the matrix selected rows collection clicking the checkboxes one by one, but when i use the multiple selection i can't get any event handling this.

I know i couldn't use the checkbox for the selection and use instead the native function of sap b1 matrix., but this way is faster (and more clear, because you see the check when a row is selected) when you have multiple rows selected one by one

I hope i've been clear enough, and hope somene can give me an hint.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

maik_delly
Active Contributor
0 Kudos

Hi Cesidio,

if I understand you correctly you want to select one row than shift+mouseclick some rows lower and the result should be, that all rows are selected ?

You can achieve this by catching the itempressed event and querying pVal.Modifiers.

This is an example for Grid :


private void Grid0_PressedAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)

        {

            if (pVal.Modifiers == SAPbouiCOM.BoModifiersEnum.mt_SHIFT)

            {

                int lastRowSelected =Grid0.Rows.SelectedRows.Item(Grid0.Rows.SelectedRows.Count-1,SAPbouiCOM.BoOrderType.ot_RowOrder);

                if (lastRowSelected < pVal.Row)

                {

                    for (int i = pVal.Row; i > lastRowSelected; i--)

                    {

                        Grid0.Rows.SelectedRows.Add(i);

                    }

                }

            }

        }

regards,

Maik

cesidio_ludovisi
Explorer
0 Kudos

Thanks Maik,

your code was very helpful to do what i want to do.

I started from it and got my code working.

Answers (0)