Skip to Content
0
Former Member
May 16, 2008 at 12:40 AM

Menu only work once!

23 Views

Hello All:

Have a UI add-on that have menu button that opens a user form... It works great first time you click it, and everything the buttons text combo...etc works fine. But when you click cancel ITEMUID = "2" The menu wouldn't pop up again. I try-catch the entire thing couldn't find where it failed. BTW, this is still in debug mode. I think the thing is dead, because it doesn't recognized any other events or action after it is closed. But I am not sure why!

I have my

        static void Main()
        {
            try
            {
                AutoSalesOrder oload = new AutoSalesOrder();

                System.Windows.Forms.Application.Run();
            }
            catch (Exception ex)
            {
                Global.oapplication.MessageBox(ex.Message.ToString(), 1, "OK", "", "");
            }
        }

// Event handling

                Global.oapplication.MenuEvent += new SAPbouiCOM._IApplicationEvents_MenuEventEventHandler(SBO_Application_MenuEvent);
                Global.oapplication.AppEvent += new SAPbouiCOM._IApplicationEvents_AppEventEventHandler(SBO_Application_AppEvent);
                Global.oapplication.ItemEvent += new SAPbouiCOM._IApplicationEvents_ItemEventEventHandler(SBO_Application_ItemEvent);

Even put in these things to make sure I closed it properly...

                    case SAPbouiCOM.BoEventTypes.et_FORM_CLOSE:
                        BubbleEvent = true;
                        Global.oapplication.StatusBar.SetText("Form Closed", SAPbouiCOM.BoMessageTime.bmt_Short,
                            (SAPbouiCOM.BoStatusBarMessageType.smt_None));
                        break;
                    case SAPbouiCOM.BoEventTypes.et_CLICK:
                        if (pVal.ItemUID == "2" && pVal.BeforeAction == false)
                        {
                            BubbleEvent = false;
                            Global.oapplication.Forms.Item(FormUID).Close();
                        }
                        break;

Still not sure what's wrong with it..

Edited by: Bo Peng on May 16, 2008 2:40 AM

Edited by: Bo Peng on May 16, 2008 2:58 AM