public void EditNextOnLast <T> (int row, Key keyCode, Column colNext, CellValueContiueEdit nextHandler, BindList <T> details, Func <T> addNewDetail = null, bool createRows = true) where T : OperationDetail { if (details.Count - 1 > row || (details [row].ItemId > 0 && (keyCode == Key.Return || keyCode == Key.KP_Enter))) { row++; } if (details.Count <= row) { if (!createRows) { row = details.Count - 1; } else if (addNewDetail != null) { addNewDetail(); } else { details.AddNew(); } } EditNext(row, keyCode, colNext, nextHandler); }
public void EditNext(int row, Key keyCode, Column colNext, CellValueContiueEdit nextHandler) { if (colNext != null && colNext.ListCell.IsEditable) { if (cellEditor(row, colNext.Index)) { return; } } nextHandler(row, keyCode); }
public void EditPrev(int row, Key keyCode, Column colPrev, CellValueContiueEdit prevHandler) { if (colPrev != null && colPrev.ListCell.IsEditable) { if (cellEditor(row, colPrev.Index)) { return; } } prevHandler(row, keyCode); }
private void ContinueEditingIfValid(CellKeyPressEventArgs args, CellValueEvaluator evaluator, CellValueChooser chooser, string filter, CellValueContiueEdit contiueEdit) { if (evaluator(grid.EditedCell.Row, args.Entry.Text)) { contiueEdit(grid.EditedCell.Row, args.GdkKey); } else if (chooser != null) { chooser(filter); } }
public void EditPrevOnFirst(int row, Key keyCode, Column colPrev, CellValueContiueEdit prevHandler, RowDeleter delHandler) { if (keyCode == Key.BackSpace) { delHandler(row); return; } if (row > 0) { row--; } EditPrev(row, keyCode, colPrev, prevHandler); }
public bool ColumnKeyPress(CellKeyPressEventArgs args, int colIndex, CellValueChooser chooser, CellValueEvaluator evaluator, CellValueContiueEdit editPrev, CellValueContiueEdit editNext) { if (args == null) { throw new ArgumentNullException("args"); } string filter = args.Editing ? args.Entry.Text : string.Empty; if (KeyShortcuts.Equal(args.EventKey, KeyShortcuts.ChooseKey)) { args.MarkAsHandled(); return(ChooseCellValue(evaluator, chooser, filter)); } switch (args.GdkKey) { case Key.Tab: case Key.Return: case Key.KP_Enter: if (args.Editing) { ContinueEditingIfValid(args, evaluator, chooser, filter, editNext); } break; case Key.Right: if (args.Editing) { // If the cursor is at the end of the text if (args.Entry.CursorPosition == args.Entry.Text.Length) { ContinueEditingIfValid(args, evaluator, chooser, filter, editNext); } } break; case Key.Left: case Key.ISO_Left_Tab: if (args.Editing) { // If the cursor is at the end of the text if (args.Entry.CursorPosition == args.Entry.Text.Length || args.Entry.CursorPosition == 0 || args.GdkKey == Key.ISO_Left_Tab) { ContinueEditingIfValid(args, evaluator, chooser, filter, editPrev); } } break; case Key.Up: case Key.KP_Up: if (args.Editing) { evaluator(grid.EditedCell.Row, args.Entry.Text); cellUpEditor(colIndex); } break; case Key.Down: case Key.KP_Down: if (args.Editing) { evaluator(grid.EditedCell.Row, args.Entry.Text); cellDownEditor(colIndex); } break; case Key.BackSpace: if (args.Editing) { if (args.Entry.Text.Length == 0) { evaluator(grid.EditedCell.Row, args.Entry.Text); editPrev(grid.EditedCell.Row, args.GdkKey); } } break; default: return(false); } return(true); }
public bool ColumnKeyPress(CellKeyPressEventArgs args, int colIndex, CellValueEvaluator evaluator, CellValueContiueEdit editPrev, CellValueContiueEdit editNext) { return(ColumnKeyPress(args, colIndex, null, evaluator, editPrev, editNext)); }