on 09-04-2008 10:03 AM
Hi All,
I tried following code for sorting number of first column of matrix. But when i click on AddRow menu it gives error and when i use commented line code that time it adds one row but number shows in column last row number.
And when i click on DeleteRow menu it delete only first time second time it is not working.
Can anybody tell me where i am wrong ? Plz suggest me exact code.
Public Sub SBO_Application_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean)
Dim item As Matrix
formd = SBO_Application.Forms.ActiveForm
item = formd.Items.Item("2").Specific
Dim i As Integer
If pVal.MenuUID = "1292" Then
' item.AddRow(1, 1)
item.Columns.cells.item(item.RowCount).specific.value = item.RowCount
BubbleEvent = False
End If
If pVal.MenuUID = "1293" Then
For i = 1 To item.VisualRowCount
item.Columns.Item("V_-1").Cells.Item(i).Specific.value = i
Next
item.FlushToDataSource()
BubbleEvent = False
End If
End Sub
Hi Harish,
For deleting a row try this one:
If (pVal.MenuUID = "OnlyOnRC") And (pVal.BeforeAction = False) Then
Try
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Dim omat As SAPbouiCOM.Matrix
Dim GCols As SAPbouiCOM.Columns
Dim i As Integer
oitem = OForm.Items.Item("38")
omat = oitem.Specific
GCols = omat.Columns
omat = OForm.Items.Item(selItem).Specific
For i = 1 To omat.RowCount
If omat.IsRowSelected(i) = True Then
omat.DeleteRow(i)
Exit For
End If
Next
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
Kind Regards
Mohana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi..
just copy and paste my code definitely it will work.
Regards...
Billa 2007
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bill,
I tried ur code. It works means it delete row. But When i am deleteing any row it delete but not change the number order means suppose i delete 2 number row delete 3 row display on 2 means not change order. And when i adding new row that time it adding but other row value changeing.
I am also taking on form load for showing number, But it is not work. What i do ?
If item.RowCount = 0 Then
item.AddRow()
item.Columns.Item("V_-1").Cells.Item(item.RowCount).Specific.value = item.RowCount
End If
Thanks
Hi...
Copy the code and change ur matrix id...
Private Sub SBO_Application_RightClickEvent(ByRef eventInfo As SAPbouiCOM.ContextMenuInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.RightClickEvent
If eventInfo.FormUID = "Ur Form ID" Then
If (eventInfo.BeforeAction = True) Then
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Dim omat As SAPbouiCOM.Matrix
Dim GCols As SAPbouiCOM.Columns
oitem = OForm.Items.Item("Ur Matrix")
omat = oitem.Specific
GCols = omat.Columns
Try
selItem = eventInfo.ItemUID
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "OnlyOnRC"
oCreationPackage.String = "Delete Row"
oCreationPackage.Enabled = True
oMenuItem = SBO_Application.Menus.Item("1280") 'Data'
oMenus = oMenuItem.SubMenus
oMenus.AddEx(oCreationPackage)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Else
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Try
SBO_Application.Menus.RemoveEx("OnlyOnRC")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
End If
End Sub
Menu Event...
If (pVal.MenuUID = "OnlyOnRC") And (pVal.BeforeAction = False) Then
Try
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Dim omat As SAPbouiCOM.Matrix
Dim GCols As SAPbouiCOM.Columns
Dim i As Integer
oitem = OForm.Items.Item("Ur Matrix")
omat = oitem.Specific
GCols = omat.Columns
omat = OForm.Items.Item(selItem).Specific
For i = 1 To omat.RowCount
If omat.IsRowSelected(i) = True Then
omat.DeleteRow(i)
Exit For
End If
Next
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
It will work..
Regards..
Billa 2007
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi...
Private Sub SBO_Application_RightClickEvent(ByRef eventInfo As SAPbouiCOM.ContextMenuInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.RightClickEvent
declare global
dim selItem as string
Regards..
Billa 2007
Edited by: Billa 2007 on Sep 4, 2008 4:32 PM
Edited by: Billa 2007 on Sep 4, 2008 4:32 PM
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.