/// <summary> /// Create menu when rihgt click in matrix /// menu Add Row and Delete Row public void RightClickEvent_AltItem(ref ContextMenuInfo eventInfo, ref bool bubbleEvent) { Form oForm = oSBOApplication.Forms.ActiveForm; if (eventInfo.BeforeAction == true && eventInfo.ItemUID == "mt_1") { MenuItem oMenuItem = null; Menus oMenus = null; MenuCreationParams oCreateionPackage = null; try { oCreateionPackage = oSBOApplication.CreateObject(BoCreatableObjectType.cot_MenuCreationParams); oCreateionPackage.Type = BoMenuType.mt_STRING; oCreateionPackage.UniqueID = "AltItemAdd"; oCreateionPackage.Position = 1; oCreateionPackage.String = "Add Row"; oCreateionPackage.Enabled = true; oMenuItem = oSBOApplication.Menus.Item("1280"); oMenus = oMenuItem.SubMenus; oMenus.AddEx(oCreateionPackage); oCreateionPackage = oSBOApplication.CreateObject(BoCreatableObjectType.cot_MenuCreationParams); oCreateionPackage.Type = BoMenuType.mt_STRING; oCreateionPackage.UniqueID = "AltItemDel"; oCreateionPackage.Position = 2; oCreateionPackage.String = "Delete Row"; oCreateionPackage.Enabled = true; oMenuItem = oSBOApplication.Menus.Item("1280"); oMenus = oMenuItem.SubMenus; oMenus.AddEx(oCreateionPackage); } catch (Exception ex) { oSBOApplication.MessageBox(ex.Message); } finally { Utils.releaseObject(oMenuItem); Utils.releaseObject(oMenus); Utils.releaseObject(oCreateionPackage); } GeneralVariables.iDelRow = eventInfo.Row; } else { oSBOApplication.Menus.RemoveEx("AltItemAdd"); oSBOApplication.Menus.RemoveEx("AltItemDel"); } Utils.releaseObject(oForm); }
private void CreateForm() { SAPbouiCOM.FormCreationParams oCP = null; SAPbouiCOM.Item oItem = null; SAPbouiCOM.StaticText oStatic = null; SAPbouiCOM.Button oButton = null; SAPbouiCOM.EditText oEdit = null; // Setting the form creation params oCP = ((SAPbouiCOM.FormCreationParams)(SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams))); oCP.UniqueID = "CFL3"; oCP.FormType = "CFL3"; oCP.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Sizable; // Adding the form oForm = SBO_Application.Forms.AddEx(oCP); oForm.Title = "Configuración"; oItem = oForm.Items.Add("StaticTxt", SAPbouiCOM.BoFormItemTypes.it_STATIC); oItem.Left = 10; oItem.Top = 20; oItem.LinkTo = "EditTxt"; oItem.Width = 200; oStatic = ((SAPbouiCOM.StaticText)(oItem.Specific)); oStatic.Caption = "Carpeta de archivos"; oItem = oForm.Items.Add("StaticTxt2", SAPbouiCOM.BoFormItemTypes.it_STATIC); oItem.Left = 10; oItem.Top = 50; oItem.LinkTo = "EditTxt"; oItem.Width = 200; oStatic = ((SAPbouiCOM.StaticText)(oItem.Specific)); oStatic.Caption = "Kilometros recorridos"; oItem = oForm.Items.Add("txtKM", SAPbouiCOM.BoFormItemTypes.it_EDIT); oItem.Left = 120; oItem.Top = 50; oItem.LinkTo = "StaticTxt2"; oEdit = ((SAPbouiCOM.EditText)(oItem.Specific)); oItem = oForm.Items.Add("StaticTxt3", SAPbouiCOM.BoFormItemTypes.it_STATIC); oItem.Left = 10; oItem.Top = 80; oItem.LinkTo = "EditTxt"; oStatic = ((SAPbouiCOM.StaticText)(oItem.Specific)); oStatic.Caption = "Horas de motor"; oItem = oForm.Items.Add("txtHoras", SAPbouiCOM.BoFormItemTypes.it_EDIT); oItem.Left = 120; oItem.Top = 80; oItem.LinkTo = "StaticTxt3"; oEdit = ((SAPbouiCOM.EditText)(oItem.Specific)); // Adding a CFL button oItem = oForm.Items.Add("btnGuardar", SAPbouiCOM.BoFormItemTypes.it_BUTTON); oItem.Left = 120; oItem.Top = 110; oButton = ((SAPbouiCOM.Button)(oItem.Specific)); oButton.Type = SAPbouiCOM.BoButtonTypes.bt_Caption; oButton.Caption = "Guardar"; oItem.Width = 100; oItem.Height = 20; oForm.Width = 300; oForm.Height = 300; oForm.Visible = true; }
public static SAPbouiCOM.Form CriarForm( SAPbouiCOM.Application oApplication , SAPbouiCOM.BoFormBorderStyle pBoFormBorderStyle , string pFormType , string pUniqueID , int pClientHeight , int pClientWidth , bool pAutoManaged , int pSupportedModes , string pTitle , int pHeight = 0 , int pWidth = 0 , int pTop = 0 , int pLeft = 0 ) { SAPbouiCOM.Form oForm; try { oForm = oApplication.Forms.Item(pUniqueID); oForm.Close(); oForm = null; GC.Collect(); } catch { } SAPbouiCOM.FormCreationParams cp = null; cp = ((SAPbouiCOM.FormCreationParams)(oApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams))); cp.BorderStyle = pBoFormBorderStyle; cp.FormType = pFormType; cp.UniqueID = pUniqueID; oForm = oApplication.Forms.AddEx(cp); if (!string.IsNullOrEmpty(pTitle)) { oForm.Title = pTitle; } if (pClientHeight > 0) { oForm.ClientHeight = pClientHeight; } if (pClientWidth > 0) { oForm.ClientWidth = pClientWidth; } if (pHeight > 0) { oForm.Height = pHeight; } if (pTop > 0) { oForm.Top = pTop; } if (pLeft > 0) { oForm.Left = pLeft; } if (pWidth > 0) { oForm.Width = pWidth; } oForm.AutoManaged = pAutoManaged; oForm.SupportedModes = pSupportedModes; return(oForm); }