Create a Custom Common Properties Form - Intergraph Smart Electrical - Help - Hexagon

Intergraph Smart Electrical Help

Language
English
Product
Intergraph Smart Electrical
Search by Category
Help
Smart Electrical Version
10

The following procedure contains the required work flow for the creation of a customized common properties form in Microsoft Visual Studio.

  1. In Microsoft Visual Studio, create a C# Windows Form Application project.

    You must use Microsoft .NET Framework 4.6.2.

  2. Add any required references to SPELControls.dll and SpelCustomUIInf.dll

  3. Inside the Form1.cs file, add Namespaces, Ingr.Spel.SPELControls, and SpelCustomInf.

  4. Set Form1.cs to implement ISPLCustomForm interface.

  5. Add required controls to the form.

    A Combo box must be of type SPELCombobox.

  6. Define a tag for each control with the appropriate name.

    The tag name must be the same as the Smart Electrical property name in the Data Dictionary.

  7. Set Class Library as an Output type.

  8. Build the project.

  9. Place the project output .dll in the application bin folder with the SPELCustomForms.xml and SPELCustomForms.xsd files.

Example Code for Creating a Custom Motor Form.

    public partial class MotorForm : Form, ISPELCustomForm

    {

        IFormEngine _formEngine;

        public MotorForm()

        {

            InitializeComponent();

        }

        public Form CreateForm(string strFormName, IFormEngine objFormEngine)

        {

            this._formEngine = objFormEngine;

            this.Name = strFormName;

            return this;

        }

        // method must be added to a DropDown event for fill the combo

        private void comboBox1_DropDown(object sender, EventArgs e)

        {

            _formEngine.OnDropDown(sender as SPELComboBox);

        }

        // must be added to SelectedIndexChanged event for select value

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)

        {

            _formEngine.ValueChange(sender as SPELComboBox);

        }

        private void comboBox2_DropDown(object sender, EventArgs e)

        {

            _formEngine.OnDropDown(sender as SPELComboBox);

        }

        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)

        {

            _formEngine.ValueChange(sender as SPELComboBox);

        }

        // method for textbox value change

        private void textBox2_TextChanged(object sender, EventArgs e)

        {

            _formEngine.ValueChange(sender as TextBox);

        }

        private void comboBox3_DropDown(object sender, EventArgs e)

        {

            _formEngine.OnDropDown(sender as SPELComboBox);

        }

        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)

        {

            _formEngine.ValueChange(sender as SPELComboBox);

        }

        // to save changes to a database

        private void button1_Select(object sender, EventArgs e)

       {

            Cursor.Current = Cursors.WaitCursor;

            _formEngine.SaveChanges();

            this.Close();

        }

        // to close the form

        private void button2_Select(object sender, EventArgs e)

        {

            this.Close();

        }

    }