cancel
Showing results for 
Search instead for 
Did you mean: 

Matrix

Former Member
0 Kudos

Hi

   I am displaying data in a matrix . I want the color of row should change on which row user clicked.

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

pvsbprasad
Active Contributor
0 Kudos

Hi,

Try this..

   Dim oGridSetting As SAPbouiCOM.CommonSetting = Me.m_Grid.CommonSetting

            For i As Integer = 2 To Me.m_Grid.DataTable.Rows.Count Step 2

                oGridSetting.SetRowBackColor(i, CONSTANTS.ROW_BACKGROUND_GRAY)

            Next i

Regards,

Prasad

Former Member
0 Kudos

Hi

  I am using Sap Business One 2007

  It is giving message SAPbouiCOM.CommonSetting is not defined

  Constants.ROW_BACKGROUND_GRAY is not a member of Microsoft.VisualBasic.Constants

Thanks

pvsbprasad
Active Contributor
0 Kudos

Hi,

Coloring feature is not available in coding of 2007.it is working from 8.82 patch

Regards,

Prasad

Former Member
0 Kudos

HI.

YOU CAN USE DOUBLE CLICK EVENT

TRY

''    If (pVal.BeforeAction = TRUE And pVal.ITEMUID = "YOURMATRIXUID" AND PVAL.FORMUID="YOURFORMUID") Then

IF PVAL.COLUID="YOURMATRIXCOLUMNUID" THEN

--EXAMPLES PVAL.COLUID ="V-_1"  FOR FIRST COLUMN #

  ''            omatrix = oForm.Items.Item("MATRIXUID").Specific

        ''            For i As Integer = 1 To omatrix.VISUALROWCOUNT

        ''                If (omatrix.IsRowSelected(i) = True) Then

                          omatrix.CommonSetting.SetCellBackColor(i, 10, -7)

                                  I= ROW AND 10 IS COLUMN -7 IS RGB COLOR

        ''         

                           END IF

                                 END IF

END IF

REFER NET FOR RGB COLOR CODES..

Former Member
0 Kudos

Hi

  I have the below code but it is not going in this condition

If pVal.ColUID = "V-_1" Then

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent

If pVal.FormTypeEx = "TypeFrmMatrix" And pVal.BeforeAction = True Then

Try

If (pVal.ItemUID = "MATRIX1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) Then

If pVal.ColUID = "V-_1" Then

oMatrix = oForm.Items.Item("MATRIXUID").Specific

For i As Integer = 1 To oMatrix.VisualRowCount

If (oMatrix.IsRowSelected(i) = True) Then

  oMatrix.CommonSetting.SetCellBackColor(i, 10, -7)

End If

Next

End If

End If

Catch ex As Exception

SBO_Application.MessageBox(ex.Message)

End Try

        End If

End sub

Thanks

Former Member
0 Kudos

hi.

remove this line before sub method.

If pVal.ColUID = "V-_1" Then


end if


from sub method u need to write and then put some break points and then check it...



Former Member
0 Kudos

Hi

   This line is just reference . This line in code does not exist. I have just written this line on forum

Above code is not highlighting the row. Below is the actual code

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent

If pVal.FormTypeEx = "TypeFrmMatrix" And pVal.BeforeAction = True Then

Try

If (pVal.ItemUID = "MATRIX1" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) Then

If pVal.ColUID = "V-_1" Then

oMatrix = oForm.Items.Item("MATRIXUID").Specific

For i As Integer = 1 To oMatrix.VisualRowCount

If (oMatrix.IsRowSelected(i) = True) Then

  oMatrix.CommonSetting.SetCellBackColor(i, 10, -7)

End If

Next

End If

End If

Catch ex As Exception

SBO_Application.MessageBox(ex.Message)

End Try

        End If

End sub

Thanks

Former Member
0 Kudos

Hi

   I have written the below code but it is not going in - If (oMatrix.IsRowSelected(i) = True) Then condition

     If (pVal.FormTypeEx = "TypeFrmMatrix" And pVal.BeforeAction = True And pVal.ItemUID = "Matrix1") Then

            Try

                If pVal.ColUID = "Code" Then

                    oMatrix = oForm.Items.Item("Matrix1").Specific

                    For i As Integer = 1 To oMatrix.VisualRowCount

                        If (oMatrix.IsRowSelected(i) = True) Then

                            MessageBox.Show(i)

                            oMatrix.CommonSetting.SetCellBackColor(i, 10, -7)

                        End If

                    Next

                End If

            Catch ex As Exception

                SBO_Application.MessageBox(ex.Message)

            End Try

        End If

Thanks