Beispiel #1
0
 //mxd. this sets default value
 public void SetDefaultValue()
 {
     typehandler.ApplyDefaultValue();
     combobox.SelectedItem = null;
     combobox.Text         = typehandler.GetStringValue();
     combobox_Validating(this, new CancelEventArgs());
 }
Beispiel #2
0
        // Constructor for a non-fixed, defined field
        //mxd. Also for a user variable field.
        public FieldsEditorRow(DataGridView view, string name, int type, object value, bool isuservar)
        {
            //mxd. Row type
            this.rowtype = (isuservar ? FieldsEditorRowType.USERVAR : FieldsEditorRowType.DYNAMIC);

            // Type
            this.fieldtype = General.Types.GetFieldHandler(type, value);

            // Make all cells
            base.CreateCells(view);

            //mxd. Our path splits here...
            if (isuservar)
            {
                // Not defined
                this.DefaultCellStyle.ForeColor = SystemColors.GrayText;
                isdefined = false;
                fieldtype.ApplyDefaultValue();

                // Setup property cell
                this.Cells[0].Value    = name;
                this.Cells[0].ReadOnly = true;

                // Setup type cell
                this.Cells[1].Value    = fieldtype.GetDisplayType();
                this.Cells[1].ReadOnly = true;

                // Setup value cell
                this.Cells[2].Value = fieldtype.GetStringValue();
            }
            else
            {
                // Defined
                this.DefaultCellStyle.ForeColor = SystemColors.WindowText;
                isdefined = true;

                // Setup property cell
                this.Cells[0].Value    = name;
                this.Cells[0].ReadOnly = true;

                // Setup type cell
                this.Cells[1].Value    = fieldtype.GetDisplayType();
                this.Cells[1].ReadOnly = false;

                // Setup value cell
                this.Cells[2].Value = fieldtype.GetStringValue();
            }

            // We have no destructor
            GC.SuppressFinalize(this);
        }
Beispiel #3
0
        // This undefines the field
        // ONLY VALID FOR FIXED AND USERVAR FIELDS
        // You should just delete non-fixed fields
        public void Undefine()
        {
            // Must be fixed!
            if (rowtype != FieldsEditorRowType.FIXED && rowtype != FieldsEditorRowType.USERVAR)
            {
                throw new InvalidOperationException();
            }

            // Now undefined
            if (rowtype == FieldsEditorRowType.USERVAR)
            {
                fieldtype.ApplyDefaultValue();
            }
            else
            {
                fieldtype.SetValue(fieldinfo.Default);
            }

            this.Cells[2].Value             = fieldtype.GetStringValue();
            this.DefaultCellStyle.ForeColor = SystemColors.GrayText;
            isdefined = false;
        }