代码不起作用

2020-08-15 05:01发布

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


我有下面的代码,但不会在oApp_menuEvent中出现

公共clsCommon()
         {
             尝试
             {
                 SetApplication();
                 oCompany =(SAPbobsCOM.Company)oApp.Company.GetDICompany();
                 oApp.MessageBox(" U r连接到:" + oCompany.CompanyName,1,"确定","","");
                 AddMenuItems();
                 bool tmpBool = true;
                 oApp.MenuEvent + =新的SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(oApp_MenuEvent);
                 oApp.AppEvent + =新的SAPbouiCOM._IApplicationEvents_AppEventEventHandler(oApp_AppEvent);
             }
             抓住(前例外)
             {
                 MessageBox.Show(ex.Message);
             }
         }


         私有无效AddMenuItems()
         {
             SAPbouiCOM.Menus oMenus = null;
             SAPbouiCOM.MenuItem oMenuItem = null;


             int i = 0; //用作计数器
             int lAddAfter = 0;
             oMenus = oApp.Menus;
              SAPbouiCOM.MenuCreationParams oCreationPackage = null;
             oCreationPackage =(((SAPbouiCOM.MenuCreationParams)(oApp.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams))));;
             oMenuItem = oApp.Menus.Item(" 43520"); //模样

             字符串sPath = null;
             sPath = Application.StartupPath;
             sPath = sPath.Remove(sPath.Length-9,9);

             oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
             oCreationPackage.UniqueID =" MyMenu01";
             oCreationPackage.String ="示例菜单";
             oCreationPackage.Enabled = true;
             oCreationPackage.Image = sPath +" UI.bmp";
             oCreationPackage.Position = 15;
             oMenus = oMenuItem.SubMenus;
             尝试
             {
                 oMenus.AddEx(oCreationPackage);
                 oMenuItem = oApp.Menus.Item(" MyMenu01");
                 oMenus = oMenuItem.SubMenus;


                 oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING;
                 oCreationPackage.UniqueID =" MySubMenu";
                 oCreationPackage.String ="样本子菜单";
                 oMenus.AddEx(oCreationPackage);
             }
             抓(Exception er)
             {
             }
         }


         私有无效oApp_MenuEvent(参考SAPbouiCOM.MenuEvent pVal,bool BubbleEvent除外)
         {
             BubbleEvent = false;
             如果(pVal.BeforeAction == false)
             {
                 开关(pVal.MenuUID)
                 {
                     情况" MySubMenu":
                         GatePass();
                         打破;
                 }
             }
         }

 

谢谢

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


我有下面的代码,但不会在oApp_menuEvent中出现

公共clsCommon()
         {
             尝试
             {
                 SetApplication();
                 oCompany =(SAPbobsCOM.Company)oApp.Company.GetDICompany();
                 oApp.MessageBox(" U r连接到:" + oCompany.CompanyName,1,"确定","","");
                 AddMenuItems();
                 bool tmpBool = true;
                 oApp.MenuEvent + =新的SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(oApp_MenuEvent);
                 oApp.AppEvent + =新的SAPbouiCOM._IApplicationEvents_AppEventEventHandler(oApp_AppEvent);
             }
             抓住(前例外)
             {
                 MessageBox.Show(ex.Message);
             }
         }


         私有无效AddMenuItems()
         {
             SAPbouiCOM.Menus oMenus = null;
             SAPbouiCOM.MenuItem oMenuItem = null;


             int i = 0; //用作计数器
             int lAddAfter = 0;
             oMenus = oApp.Menus;
              SAPbouiCOM.MenuCreationParams oCreationPackage = null;
             oCreationPackage =(((SAPbouiCOM.MenuCreationParams)(oApp.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams))));;
             oMenuItem = oApp.Menus.Item(" 43520"); //模样

             字符串sPath = null;
             sPath = Application.StartupPath;
             sPath = sPath.Remove(sPath.Length-9,9);

             oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_POPUP;
             oCreationPackage.UniqueID =" MyMenu01";
             oCreationPackage.String ="示例菜单";
             oCreationPackage.Enabled = true;
             oCreationPackage.Image = sPath +" UI.bmp";
             oCreationPackage.Position = 15;
             oMenus = oMenuItem.SubMenus;
             尝试
             {
                 oMenus.AddEx(oCreationPackage);
                 oMenuItem = oApp.Menus.Item(" MyMenu01");
                 oMenus = oMenuItem.SubMenus;


                 oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING;
                 oCreationPackage.UniqueID =" MySubMenu";
                 oCreationPackage.String ="样本子菜单";
                 oMenus.AddEx(oCreationPackage);
             }
             抓(Exception er)
             {
             }
         }


         私有无效oApp_MenuEvent(参考SAPbouiCOM.MenuEvent pVal,bool BubbleEvent除外)
         {
             BubbleEvent = false;
             如果(pVal.BeforeAction == false)
             {
                 开关(pVal.MenuUID)
                 {
                     情况" MySubMenu":
                         GatePass();
                         打破;
                 }
             }
         }

 

谢谢

付费偷看设置
发送
1条回答
浮生未央
1楼-- · 2020-08-15 06:04

您好 JS

为什么要设置 BubbleEvent = false; 在 oApp_MenuEvent()中? 将其更改为true并与我们共享结果。

如果为true,则应用程序将在当前事件处理程序完成后处理该事件 (默认)。

问候,

ANKIT CHAUHAN

SAP业务一 支持

一周热门 更多>