示例#1
0
 void onCellActivated(CellActivatedEventArgs cellEvt)
 {
     if (cellEvt.Row >= 0)
     {
         var id    = cellEvt.Table.Rows[cellEvt.Row][0];
         var files = new Views.UI_Files();
         files.ShowModal(id.ToString());
     }
 }
示例#2
0
        private void EditCurrentCell(CellActivatedEventArgs e)
        {
            if (e.Table == null)
            {
                return;
            }

            var  oldValue  = e.Table.Rows[e.Row][e.Col].ToString();
            bool okPressed = false;

            var ok = new Button("Ok", is_default: true);

            ok.Clicked += () => { okPressed = true; Application.RequestStop(); };
            var cancel = new Button("Cancel");

            cancel.Clicked += () => { Application.RequestStop(); };
            var d = new Dialog("Enter new value", 60, 20, ok, cancel);

            var lbl = new Label()
            {
                X    = 0,
                Y    = 1,
                Text = e.Table.Columns[e.Col].ColumnName
            };

            var tf = new TextField()
            {
                Text  = oldValue,
                X     = 0,
                Y     = 2,
                Width = Dim.Fill()
            };

            d.Add(lbl, tf);
            tf.SetFocus();

            Application.Run(d);

            if (okPressed)
            {
                try {
                    e.Table.Rows[e.Row][e.Col] = string.IsNullOrWhiteSpace(tf.Text.ToString()) ? DBNull.Value : (object)tf.Text;
                }
                catch (Exception ex) {
                    MessageBox.ErrorQuery(60, 20, "Failed to set text", ex.Message, "Ok");
                }

                tableView.Update();
            }
        }
示例#3
0
        private void EditCurrentCell(CellActivatedEventArgs e)
        {
            if (e.Table == null)
            {
                return;
            }

            var oldValue = e.Table.Rows[e.Row][e.Col].ToString();

            if (GetText("Enter new value", e.Table.Columns[e.Col].ColumnName, oldValue, out string newText))
            {
                try {
                    e.Table.Rows[e.Row][e.Col] = string.IsNullOrWhiteSpace(newText) ? DBNull.Value : (object)newText;
                }
                catch (Exception ex) {
                    MessageBox.ErrorQuery(60, 20, "Failed to set text", ex.Message, "Ok");
                }

                tableView.Update();
            }
        }
示例#4
0
 private void _gDataView_CellActivated(object sender, CellActivatedEventArgs e)
 {
     try
     {
         DataRecord dataRecord = e.Cell.Record;
         dataRecord.Cells["IsNewRecord"].Value = false;
     }
     catch (Exception ex)
     {
         HandleExceptions(ex);
     }
 }
示例#5
0
 void onCellActivated(CellActivatedEventArgs cellEvt)
 {
     FileRestore();
 }