on 05-12-2009 2:15 PM
Hi,
Iam new to SAP B1 2007.I need to delete a row in a matrix using right click.
I have a main class gets called where I have created Menus and submenus.
I also tried creating the menu for right click with the below code ,given by SDK.But,second time when I build it shows the unique ID exist already.Iam unable to call this method in the constructor as I do for other menus,because the parameters are different for my class constructor.
This is code for Right click Menu creation.
Private Sub SBO_Application_RightClickEvent(ByRef eventInfo As SAPbouiCOM.ContextMenuInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.RightClickEvent
If eventInfo.FormUID = "RightClk" Then
If (eventInfo.BeforeAction = True) Then
Dim oMenuItem As SAPbouiCOM.MenuItem
Dim oMenus As SAPbouiCOM.Menus
Try
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "OnlyOnRC"
oCreationPackage.String = "Only On Right Click"
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
Now,Consider I have created the menu on right click and I get the menu 'Only On Right Click'.
I have a seperate class for writing the events of the screen and usually I call this event method in my ItemEvent of the main class.
Having only (eventinfo,bubbleevent ) ,as my parameter I am wondering how do I catch the 'Only On Right Click' menu in my right click in the Item Event and add the delete row code.
Thanks In Advance
Hi Muthukumar,
To resolve the issue with "unique id already exists", you can try this:
In the right click event handler, check the ContextMenuInfo.BeforeAction property. If the BeforeAction is true, then load your menu. If the BeforeAction is false, then remove your menu.
To catch the menu click, use the MenuEvent event handler (instead of ItemEvent) and read the property MenuEvent.MenuUID. You can also refer to MenuEvent code sample in SDK Help.
HTH
Aravind
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
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.