Exemple #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="checkEnable"></param>
 /// <param name="checkState"></param>
 /// <param name="caption"></param>
 /// <param name="readOnly"></param>
 public CheckBoxStatus(bool checkEnable, DevAge.Drawing.CheckBoxState checkState, string caption, bool readOnly)
 {
     //[email protected]:Constructors and new readonly field: CheckBox status should reflect whether it is readonly or not.
     ReadOnly    = readOnly;
     CheckEnable = checkEnable;
     mCheckState = checkState;
     Caption     = caption;
 }
Exemple #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="checkEnable"></param>
        /// <param name="bChecked"></param>
        /// <param name="caption"></param>
        public CheckBoxStatus(bool checkEnable, bool? bChecked, string caption)
        {
            CheckEnable = checkEnable;
            Caption = caption;

            mCheckState = DevAge.Drawing.CheckBoxState.Undefined;
            Checked = bChecked;
        }
Exemple #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="checkEnable"></param>
 /// <param name="checkState"></param>
 /// <param name="caption"></param>
 public CheckBoxStatus(bool checkEnable, DevAge.Drawing.CheckBoxState checkState, string caption)
 {
     CheckEnable = checkEnable;
     mCheckState = checkState;
     Caption     = caption;
 }
Exemple #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="checkEnable"></param>
 /// <param name="checkState"></param>
 /// <param name="caption"></param>
 public CheckBoxStatus(bool checkEnable, DevAge.Drawing.CheckBoxState checkState, string caption)
 {
     CheckEnable = checkEnable;
     mCheckState = checkState;
     Caption = caption;
 }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            grid1.Redim(30, 2);

            grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("Checked");
            grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("CheckStatus");

            SourceGrid.Cells.Editors.ComboBox combo = new SourceGrid.Cells.Editors.ComboBox(typeof(DevAge.Drawing.CheckBoxState));

            DependencyColumn boolToStatus = new DependencyColumn(1);

            boolToStatus.ConvertFunction = delegate(object valBool)
            {
                if (valBool == null)
                {
                    return(DevAge.Drawing.CheckBoxState.Undefined);
                }
                else if ((bool)valBool == true)
                {
                    return(DevAge.Drawing.CheckBoxState.Checked);
                }
                else
                {
                    return(DevAge.Drawing.CheckBoxState.Unchecked);
                }
            };

            DependencyColumn statusToBool = new DependencyColumn(0);

            statusToBool.ConvertFunction = delegate(object valStatus)
            {
                DevAge.Drawing.CheckBoxState status =
                    (DevAge.Drawing.CheckBoxState)valStatus;

                if (status == DevAge.Drawing.CheckBoxState.Undefined)
                {
                    return(null);
                }
                else if (status == DevAge.Drawing.CheckBoxState.Checked)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            };

            for (int r = 1; r < grid1.RowsCount; r++)
            {
                grid1[r, 0] = new SourceGrid.Cells.CheckBox(null, null);
                grid1[r, 0].Editor.AllowNull = true;
                grid1[r, 0].AddController(boolToStatus);

                grid1[r, 1] = new SourceGrid.Cells.Cell(DevAge.Drawing.CheckBoxState.Undefined, combo);
                grid1[r, 1].AddController(statusToBool);
            }

            grid1.AutoSizeCells();
        }