private void AddMenuItems() { SAPbouiCOM.Menus oMenus = null; SAPbouiCOM.MenuItem oMenuItem = null; int i = 0; int iAddAfter = 0; string sXML = null; string sPath = null; oMenus = oApplication.Menus; SAPbouiCOM.MenuCreationParams oMenuCreationParams = null; oMenuCreationParams = (SAPbouiCOM.MenuCreationParams)(oApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)); oMenuItem = oApplication.Menus.Item("43520"); sPath = Application.StartupPath; //sPath = sPath.Remove(sPath.Length - 9, 0); oMenuCreationParams.Type = BoMenuType.mt_POPUP; oMenuCreationParams.UniqueID = "menu01"; oMenuCreationParams.String = "Menu Exemplo"; oMenuCreationParams.Enabled = true; oMenuCreationParams.Image = sPath + @"\\UI.bmp"; oMenuCreationParams.Position = 99; oMenus = oMenuItem.SubMenus; try { oMenus.AddEx(oMenuCreationParams); oMenuItem = oApplication.Menus.Item("menu01"); oMenus = oMenuItem.SubMenus; oMenuCreationParams.Type = BoMenuType.mt_STRING; oMenuCreationParams.UniqueID = "menu02"; oMenuCreationParams.String = "Sub Menu Exemplo"; oMenus.AddEx(oMenuCreationParams); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
private void CriarFormularioComMatrix() { SAPbouiCOM.Button oButton = null; SAPbouiCOM.StaticText oStaticText = null; SAPbouiCOM.EditText oEditText = null; SAPbouiCOM.FormCreationParams oCreationParams = null; oCreationParams = ((SAPbouiCOM.FormCreationParams)(oApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams))); //oCreationParams.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed; oCreationParams.UniqueID = "frmMtx"; oCreationParams.FormType = "frmMtx"; oForm = oApplication.Forms.AddEx(oCreationParams); oForm.Title = "Matrix, DataSources and Linked Buttons"; oForm.Left = 336; oForm.ClientWidth = 520; oForm.Top = 44; oForm.ClientHeight = 200; oItem = oForm.Items.Add("1 ", BoFormItemTypes.it_BUTTON); oItem.Left = 5; oItem.Width = 65; oItem.Top = 170; oItem.Height = 19; oButton = ((SAPbouiCOM.Button)(oItem.Specific)); oButton.Caption = "OK"; oItem = oForm.Items.Add("2 ", BoFormItemTypes.it_BUTTON); oItem.Left = 75; oItem.Width = 65; oItem.Top = 170; oItem.Height = 19; oButton = ((SAPbouiCOM.Button)(oItem.Specific)); oButton.Caption = "Cancel"; oItem = oForm.Items.Add("txtPhone", SAPbouiCOM.BoFormItemTypes.it_EDIT); oItem.Left = 265; oItem.Width = 163; oItem.Top = 172; oItem.Height = 14; oItem = oForm.Items.Add("btnPhone ", BoFormItemTypes.it_BUTTON); oItem.Left = 160; oItem.Width = 100; oItem.Top = 170; oItem.Height = 19; oButton = ((SAPbouiCOM.Button)(oItem.Specific)); oButton.Caption = "Add Phone Prefix"; this.oForm.Visible = true; AddMatrixNoForm(); }
private void CriarFormularioComplexo() { SAPbouiCOM.Button oButton = null; SAPbouiCOM.Folder oFolder = null; SAPbouiCOM.OptionBtn oOptionBtn = null; SAPbouiCOM.CheckBox oCheckBox = null; SAPbouiCOM.ComboBox oComboBox = null; SAPbouiCOM.FormCreationParams oCreationParams = null; oCreationParams = ((SAPbouiCOM.FormCreationParams)(oApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams))); oCreationParams.UniqueID = "frmComplex"; oCreationParams.FormType = "frmComplex"; oCreationParams.BorderStyle = BoFormBorderStyle.fbs_Sizable; oForm = oApplication.Forms.AddEx(oCreationParams); AddDataSourceNoForm(); oForm.Title = "Formulário Complexo"; oForm.Left = 300; oForm.ClientWidth = 200; oForm.Top = 100; oForm.ClientHeight = 140; oItem = oForm.Items.Add("1", BoFormItemTypes.it_BUTTON); oItem.Left = 5; oItem.Width = 65; oItem.Top = 110; oItem.Height = 19; oButton = ((SAPbouiCOM.Button)(oItem.Specific)); oButton.Caption = "OK"; oItem = oForm.Items.Add("2", BoFormItemTypes.it_BUTTON); oItem.Left = 75; oItem.Width = 65; oItem.Top = 110; oItem.Height = 19; oButton = ((SAPbouiCOM.Button)(oItem.Specific)); oButton.Caption = "Cancel"; oItem = oForm.Items.Add("Rect1", BoFormItemTypes.it_RECTANGLE); oItem.Left = 0; oItem.Width = 194; oItem.Top = 25; oItem.Height = 80; for (int i = 1; i <= 3; i++) { oItem = oForm.Items.Add("Folder" + i.ToString(), BoFormItemTypes.it_FOLDER); oItem.Left = (i - 1) * 100; oItem.Width = 100; oItem.Top = 6; oItem.Height = 19; oFolder = ((SAPbouiCOM.Folder)(oItem.Specific)); oFolder.Caption = "Folder" + i.ToString(); oFolder.DataBind.SetBound(true, "", "FolderDS"); if (i == 1) { oFolder.Select(); } else { oFolder.GroupWith("Folder" + Convert.ToString(i - 1)); } } for (int i = 1; i <= 3; i++) { oItem = oForm.Items.Add("OptBtn" + i.ToString(), BoFormItemTypes.it_OPTION_BUTTON); oItem.Left = 20; oItem.Width = 120; oItem.Top = 30 + (i - 1) * 19; oItem.Height = 19; oItem.FromPane = 1; oItem.ToPane = 1; oOptionBtn = ((SAPbouiCOM.OptionBtn)(oItem.Specific)); oOptionBtn.Caption = string.Format("Botão de Opção {0}", i); if (i > 1) { oOptionBtn.GroupWith("OptBtn" + Convert.ToString(i - 1)); } oOptionBtn.DataBind.SetBound(true, "", "OptBtnDS"); } for (int i = 1; i <= 3; i++) { oItem = oForm.Items.Add("CheckBox" + i.ToString(), BoFormItemTypes.it_CHECK_BOX); oItem.Left = 20; oItem.Width = 100; oItem.Top = 30 + (i - 1) * 19; oItem.Height = 19; oItem.FromPane = 2; oItem.ToPane = 2; oCheckBox = ((SAPbouiCOM.CheckBox)(oItem.Specific)); oCheckBox.Caption = string.Format("Check Box {0}", i); oCheckBox.DataBind.SetBound(true, "", string.Format("CheckDS{0}", i)); } for (int i = 1; i <= 3; i++) { oItem = oForm.Items.Add("ComboBox" + i.ToString(), BoFormItemTypes.it_COMBO_BOX); oItem.Left = 20; oItem.Width = 100; oItem.Top = 33 + (i - 1) * 19; oItem.Height = 19; oItem.FromPane = 3; oItem.ToPane = 3; oComboBox = ((SAPbouiCOM.ComboBox)(oItem.Specific)); oComboBox.ValidValues.Add("0", "Selecione"); for (int x = 1; x < 10; x++) { oComboBox.ValidValues.Add(x.ToString(), string.Format("Item {0}", x)); } oComboBox.Select("0", BoSearchKey.psk_ByValue); oItem.DisplayDesc = true; } oForm.PaneLevel = 1; }