示例#1
0
        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();
        }
示例#2
0
        private void LoadXmlForm(string pStrFrmName)
        {
            System.Xml.XmlDocument lObjXmlDoc = new System.Xml.XmlDocument();
            string lStrPath = PathUtilities.GetCurrent("ModalForms") + "\\" + pStrFrmName + ".xml";

            lObjXmlDoc.Load(lStrPath);

            SAPbouiCOM.FormCreationParams lObjCreationPackage =
                (SAPbouiCOM.FormCreationParams)SAPbouiCOM.Framework.Application.SBO_Application.CreateObject
                    (SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams);


            lObjCreationPackage.XmlData = lObjXmlDoc.InnerXml;

            if (pStrFrmName.Equals(pStrFrmName))
            {
                if (!lObjUtility.FormExists(pStrFrmName))
                {
                    lObjCreationPackage.UniqueID    = pStrFrmName;
                    lObjCreationPackage.BorderStyle = SAPbouiCOM.BoFormBorderStyle.fbs_Fixed;
                    lObjCreationPackage.Modality    = SAPbouiCOM.BoFormModality.fm_Modal;
                    lObjCreationPackage.FormType    = pStrFrmName;

                    mObjMFreights         = SAPbouiCOM.Framework.Application.SBO_Application.Forms.AddEx(lObjCreationPackage);
                    mObjMFreights.Title   = "Busqueda de rutas";
                    mObjMFreights.Left    = 400;
                    mObjMFreights.Top     = 100;
                    mObjMFreights.Mode    = SAPbouiCOM.BoFormMode.fm_OK_MODE;
                    mObjMFreights.Visible = true;
                    InitializeXmlForm();
                }
            }
            else
            {
                mObjMFreights.Select();
            }
        }
示例#3
0
        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;
        }
示例#4
0
        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;
        }
        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);
        }