Beispiel #1
0
        private void dataGridGCodeConf_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (gcodeConf == null || fillParametersInProgress || e.RowIndex < 0)
            {
                return;
            }
            DataGridViewRow row    = dataGridGCodeConf.Rows[e.RowIndex];
            string          newval = row.Cells[e.ColumnIndex].Value.ToString();

            GCodeConfig.GCodeParam par = gcodeConf.GetParams()[e.RowIndex];
            string validPar            = par.ValidateValue(newval);

            if (validPar == null)
            {
                row.Cells[e.ColumnIndex].Style = errorGridStyle;
                return;
            }
            fillParametersInProgress       = true; // eliminate reentry to this function
            row.Cells[e.ColumnIndex].Value = validPar;
            fillParametersInProgress       = false;
            int axis = e.ColumnIndex - 1;

            if (par.strVal[axis] == validPar)
            {
                row.Cells[e.ColumnIndex].Style = stdGridStyle;
            }
            else
            {
                row.Cells[e.ColumnIndex].Style = changedGridStyle;
            }
        }
Beispiel #2
0
 public void FillParameters(GCodeConfig conf)
 {
     fillParametersInProgress = true;
     dataGridGCodeConf.Rows.Clear();
     foreach (GCodeConfig.GCodeParam par in conf.GetParams())
     {
         dataGridGCodeConf.Rows.Add(par.code, par.strVal[0], par.strVal[1], par.strVal[2], par.strVal[3], par.strVal[4]);
     }
     gcodeConf = conf;
     fillParametersInProgress = false;
 }