private void LVLocations_CellEditFinishing(object sender, CellEditEventArgs e) { var item = e.RowObject as LocationForDisplay; if (item != null) { switch (e.SubItemIndex) { case 1: { var ctrl = e.Control as ComboBox; if (ctrl != null) { var selected = ctrl.SelectedItem as ComboBoxItem; if (selected != null) { item.LocationBaseId = (long)selected.Key; e.NewValue = item.LocationBase = selected.ToString(); item.DateModifiedUtc = GeneralPersistense.GetTimestamp(); GeneralPersistense.Upsert(new Location(item)); } } break; } case 2: item.LocationData = (string)e.NewValue; item.DateModifiedUtc = GeneralPersistense.GetTimestamp(); GeneralPersistense.Upsert(new Location(item)); break; } } }
/// <summary> /// Raises the CancelEdit event /// </summary> /// <param name="e">A CellEditEventArgs that contains the event data</param> protected virtual void OnCancelEdit(CellEditEventArgs e) { if (this.CancelEdit != null) { this.CancelEdit(this, e); } }
private void ObjectListViewOnCellEditStarting(object sender, CellEditEventArgs e) { if (e.Column == olvCommand) { e.Cancel = true; if (((FOOD)e.RowObject).FOOD_NAME == String.Empty) { FOOD fOOD_ = new FOOD(); fOOD_.FOOD_NAME = "Chọn Tên Món"; demos.Insert(demos.Count - 1, fOOD_); objectListViewMonAn.SetObjects(demos); } else { objectListViewMonAn.RemoveObject(e.RowObject); demos.Remove((FOOD)e.RowObject); } } else if (e.Column == olvName) { if (((FOOD)e.RowObject).FOOD_NAME == String.Empty) { e.Cancel = true; } else { Food_Name(sender, e); } } }
private void LVLocations_CellEditStarting(object sender, CellEditEventArgs e) { var item = e.RowObject as LocationForDisplay; if (item != null && e.SubItemIndex == 1) { var bases = LocationPersistence.ListBases(); var control = new ComboBox(); int selectedIndex = -1; for (int i = 0; i < bases.Count; i++) { var b = bases[i]; control.Items.Add(new ComboBoxItem(b.Id, b.Name)); if (b.Id == item.LocationBaseId) { selectedIndex = i; } } control.SelectedIndex = selectedIndex; control.Width = e.Column.Width; control.Left = e.Control.Left; e.Control = control; } }
private void OnCellEditStarting(object sender, CellEditEventArgs e) { if ((Item)e.RowObject == _totalItem) { e.Cancel = true; } }
private void advTree1_AfterCellEditComplete(object sender, CellEditEventArgs e) { #region 如果是最底下的空結點被編輯就再補一個空結點上去 if (e.Cell.Parent == InsertNode && InsertNode.Cells[0].Text != "") { 志願 newItem = new 志願() { StudentRecord = K12.Data.Student.SelectByID(PrimaryKey), 校系資料 = null }; InsertNode = new Node(); InsertNode.DataKey = newItem; InsertNode.Cells.Clear(); InsertNode.Cells.Add(new Cell()); InsertNode.Cells.Add(new Cell()); InsertNode.Cells.Add(new Cell()); InsertNode.Cells[1].CheckBoxVisible = true; InsertNode.Cells[1].CheckBoxAlignment = eCellPartAlignment.NearCenter; InsertNode.Cells[1].CheckBoxStyle = DevComponents.DotNetBar.eCheckBoxStyle.CheckBox; InsertNode.Cells[1].Checked = newItem.忽略; InsertNode.Cells[1].Text = ""; advTree1.Nodes.Add(InsertNode); } if (e.Cell.Parent != InsertNode && e.Cell.Parent.Cells.IndexOf(e.Cell) == 0 && e.Cell.Text == "") { advTree1.Nodes.Remove(e.Cell.Parent); } #endregion CheckChanged(); }
// Displays only the cumstom templates (except 'Default' and 'SDL Trados' templates which are not custom) private void DisplayCustomTemplates(ComboBox cb, CellEditEventArgs e) { if (_controller?.ProjectTemplates == null || _controller?.ProjectTemplates.Count() <= 0) { _messageBoxService.ShowWarningMessage(PluginResources.ImportCustomTemplate_Message, string.Empty); e.Cancel = true; } else { foreach (var projectTemplate in _controller.ProjectTemplates) { if (!projectTemplate.Name.Equals("Default") && !projectTemplate.Name.Equals("SDL Trados")) { cb.Items.Add(projectTemplate); } } if (cb.Items.Count > 0) { cb.SelectedIndex = 0; } else { _messageBoxService.ShowWarningMessage(PluginResources.ImportCustomTemplate_Message, string.Empty); e.Cancel = true; } e.Control = cb; } }
private void RemoveWatchFolders(CellEditEventArgs e) { foldersListView.RemoveObject(e.RowObject); var folderObject = e.RowObject as ProjectRequest; var requestToRemove = _folderPathList?.FindAll(p => p.Path == folderObject.Path); if (requestToRemove != null) { foreach (var request in requestToRemove) { _folderPathList.Remove(request); var notification = GetUINotification(request); _controller.ClearNotification(notification); } } var watchFolderToRemove = _watchFolders?.FirstOrDefault(w => w.Path == folderObject.Path); if (watchFolderToRemove != null) { _watchFolders.Remove(watchFolderToRemove); } _persistence.SaveProjectRequestList(_folderPathList); LoadProjectRequests(); }
void olv_CellEditFinishing(object sender, CellEditEventArgs e) { if (e.Column.Text == "IBAN") { Util.StatusData statusData = Util.Iban.CheckIban((string)e.NewValue, false); if (!statusData.IsValid) { MessageBox.Show(statusData.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { tblCrediteur d = (tblCrediteur)e.RowObject; d.IBAN = (string)e.NewValue; d.BIC = Util.Bic.GetBicFromIban(d.IBAN); } e.Cancel = true; } else { e.Cancel = false; } // Any updating will have been down in the SelectedIndexChanged event handler // Here we simply make the list redraw the involved ListViewItem ((ObjectListView)sender).RefreshItem(e.ListViewItem); }
/// <summary> /// A dropdown will appear when user click on a template cell /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FoldersListView_CellEditStarting(object sender, CellEditEventArgs e) { try { if (e.Column == deleteColumn) { e.Cancel = true; var confirmDelete = _messageBoxService.AskForConfirmation(PluginResources.RemoveWatchFolder_Message); if (confirmDelete) { RemoveWatchFolders(e); } } if (e.Column != templateColumn) { return; } var cb = new ComboBox { Bounds = e.CellBounds, Font = ((ObjectListView)sender).Font, DropDownStyle = ComboBoxStyle.DropDownList }; DisplayCustomTemplates(cb, e); } catch (Exception exception) { Log.Logger.Error($"FoldersListView_CellEditStarting: {exception.Message}\n {exception.StackTrace}"); } }
protected override void OnCellEditFinishing(CellEditEventArgs e) { if (e.RowObject is IPropertyValue prop) { if (e.Control is DarkUI.Controls.DarkComboBox cb) { if (typeof(MBObjectBase).IsAssignableFrom(prop.Type)) { if (e.Cancel) { return; } if (cb.SelectedItem is DarkUI.Controls.DarkListItem li) { e.NewValue = li.Tag; prop.Value = li.Tag; } return; } } } base.OnCellEditFinishing(e); }
private void olvFiles_CellEditFinishing(object sender, CellEditEventArgs e) { // Check the file name has changed if ((string)e.NewValue == (string)e.Value) { return; } // We have finished editing the cell var file = e.RowObject as XfeFileInfo; if (file == null || file.FileInfo.Directory == null) { return; } var newFile = new FileInfo(Path.Combine(file.FileInfo.Directory.FullName, (string)e.NewValue)); if (newFile.Exists) { MessageBox.Show(@"A file with that name already exists", @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error); e.Cancel = true; return; } file.FileInfo.MoveTo(newFile.FullName); }
private void listView_Wallets_CellEditFinishing(object sender, CellEditEventArgs e) { WalletBalance balance = listView_Wallets.SelectedObject as WalletBalance; if (balance != null) { WalletBalance listItem = PreferenceManager.WalletPreferences.WalletForks.FirstOrDefault(item => item.Symbol == balance.Symbol && item.Name == balance.Name); if (listItem != null) { try { Decimal newValue = Convert.ToDecimal(e.Control.Text); //LogManager.AddLogMessage(Name, "listView_Wallets_CellEditFinishing", balance.Symbol + " | " + e.Control.Text + " | " + e.Value, LogManager.LogMessageType.DEBUG); listItem.Balance = newValue; PreferenceManager.UpdatePreferenceFile(PreferenceManager.PreferenceType.Wallet); LoadWallets(); } catch (Exception ex) { LogManager.AddLogMessage(Name, "listView_Wallets_CellEditFinishing", ex.Message, LogManager.LogMessageType.EXCEPTION); } } } //LogManager.AddLogMessage(Name, "listView_Wallets_CellEditFinishing", sender + " | " + e.Control.Text + " | " + e.Value, LogManager.LogMessageType.DEBUG); }
private void objList_CellEditValidating(object sender, CellEditEventArgs e) { if (e.ListViewItem.Index == objList.Items.Count - 1) { if (!string.IsNullOrWhiteSpace(e.NewValue.ToString())) { if (IsCountryNameExist(e.NewValue.ToString(), e.ListViewItem.Index)) { GetStatusBar().DisplayMessage(MessageType.Error, "国家 \"" + e.NewValue.ToString() + "\" 已存在!"); e.Cancel = true; } } } else { if (e.SubItemIndex == 1) { if (string.IsNullOrWhiteSpace(e.NewValue.ToString())) { GetStatusBar().DisplayMessage(MessageType.Error, "国家名字不能为空!"); e.Cancel = true; } else if (IsCountryNameExist(e.NewValue.ToString(), e.ListViewItem.Index)) { GetStatusBar().DisplayMessage(MessageType.Error, "国家 \"" + e.NewValue.ToString() + "\" 已存在!"); e.Cancel = true; } } } }
private void filterTree_CellEditValidating(object sender, CellEditEventArgs e) { if (e.Column.Equals(this.olvColumnValue)) { if (e.RowObject is SearchSubrecord) { e.Cancel = true; } if (e.RowObject is SearchElement) { var se = e.RowObject as SearchElement; if (se.Record == null) { e.Cancel = true; } else { e.Cancel = !se.ValidateValue(e.NewValue); } } } this.cboSavedSearches.SelectedIndex = -1; }
/// <summary> /// Raises the BeginEdit event /// </summary> /// <param name="e">A CellEditEventArgs that contains the event data</param> protected virtual void OnBeginEdit(CellEditEventArgs e) { if (this.BeginEdit != null) { this.BeginEdit(this, e); } }
/// <summary> /// Prepares the CellEditor to edit the specified Cell /// </summary> /// <param name="cell">The Cell to be edited</param> /// <param name="table">The Table that contains the Cell</param> /// <param name="cellPos">A CellPos representing the position of the Cell</param> /// <param name="cellRect">The Rectangle that represents the Cells location and size</param> /// <param name="userSetEditorValues">Specifies whether the ICellEditors /// starting value has already been set by the user</param> /// <returns>true if the ICellEditor can continue editing the Cell, false otherwise</returns> public virtual bool PrepareForEditing(Cell cell, Table table, CellPos cellPos, Rectangle cellRect, bool userSetEditorValues) { this.cell = cell; this.table = table; this.cellPos = cellPos; this.cellRect = cellRect; // check if the user has already set the editors value for us if (!userSetEditorValues) { this.SetEditValue(); } this.SetEditLocation(cellRect); // raise the BeginEdit event var e = new CellEditEventArgs(cell, this, table, cellPos.Row, cellPos.Column, cellRect) { Handled = userSetEditorValues }; this.OnBeginEdit(e); // if the edit has been canceled, remove the editor and return false if (e.Cancel) { this.RemoveEditControl(); return(false); } return(true); }
private void AdvTree_Codes_AfterCellEdit(object sender, CellEditEventArgs e) { if (e.Cell.Parent.Tag is CustomAsmArea asm) { asm.Config.Name = e.NewText.Trim(); } }
private void listViewComplex_CellEditValidating(object sender, CellEditEventArgs e) { // Disallow professions from starting with "a" or "z" -- just to be arbitrary if (e.Column.Text == "Occupation") { string newValue = ((TextBox)e.Control).Text.ToLowerInvariant(); if (newValue.StartsWith("a") || newValue.StartsWith("z")) { e.Cancel = true; MessageBox.Show(this, "Occupations cannot begin with 'a' or 'z' (just to show cell edit validation at work).", "ObjectListViewDemo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } // Disallow birthdays from being on the 29th -- just to be arbitrary if (e.Column.Text == "Birthday") { DateTime newValue = ((DateTimePicker)e.Control).Value; if (newValue.Day == 29) { e.Cancel = true; MessageBox.Show(this, "Sorry. Birthdays cannot be on 29th of any month (just to show cell edit validation at work).", "ObjectListViewDemo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } }
/// <summary> /// Handles the CellEditStarting event of the objectListViewWorkItems control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="BrightIdeasSoftware.CellEditEventArgs"/> instance containing the event data.</param> /// <remarks>Documented by CFI, 2010-07-01</remarks> private void objectListViewWorkItems_CellEditStarting(object sender, CellEditEventArgs e) { if (e.Value is WorkItemCheckinAction && !e.ListViewItem.Checked) { e.Cancel = true; } }
private void objectListView1_CellEditFinishing(object sender, CellEditEventArgs e) { if (e.Cancel == false && e.Value is Color) { e.NewValue = _cTmp; } }
private async void OnCellEditEnded(object sender, CellEditEventArgs e) { var originalValue = _originalValue; var currentValue = grid[e.CellRange.Row, e.CellRange.Column]; if (!e.CancelEdits && (originalValue == null && currentValue != null || !originalValue.Equals(currentValue))) { MessageDialog msgbox = new MessageDialog(Strings.EditConfirmationQuestion, Strings.EditConfirmationQuestionTitle); msgbox.Commands.Clear(); msgbox.Commands.Add(new UICommand { Label = "Yes", Id = 0 }); msgbox.Commands.Add(new UICommand { Label = "No", Id = 1 }); var res = await msgbox.ShowAsync(); if ((int)res.Id == 1) { grid[e.CellRange.Row, e.CellRange.Column] = originalValue; } } }
private void TreeView_AfterCellEdit(object sender, CellEditEventArgs e) { if (e.IsUserCanceled) { return; } var item = (Section)e.Cell.Tag; if (string.IsNullOrWhiteSpace(e.NewText)) { e.Cancel = true; return; } // Check for Duplicate Record var findItem = this.OfferedCourseItem.Sections.Items.Where(_ => _.SectionName == e.NewText && _.RowId != item.RowId); if (findItem.Any()) { e.Cancel = true; FireEvent(AfterItemEdit, null); return; } item.SectionName = e.NewText; FireEvent(AfterItemEdit, item); }
private void LstItems_CellEditFinishing(object sender, CellEditEventArgs e) { if (!e.Column.CheckBoxes && !(e.Column.Renderer is DarkUI.Support.CheckStateRenderer)) { e.Control = null; } }
/// <summary> /// Displays in cell template name selected by user, and save it in json file /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FoldersListView_CellEditFinishing(object sender, CellEditEventArgs e) { if (e.Control is ComboBox) { var value = ((ComboBox)e.Control).SelectedItem; if (e.Column == templateColumn) { ((ProjectRequest)e.RowObject).ProjectTemplate = (ProjectTemplateInfo)value; foldersListView.RefreshObject((ProjectRequest)e.RowObject); } _folderPathList = _persistence.Load(); var items = _folderPathList.FindAll(p => p.Path == ((ProjectRequest)e.RowObject).Path); foreach (var item in items) { item.ProjectTemplate = (ProjectTemplateInfo)value; } Save(); InitializeListView(_watchFolders); } }
private void tlvGroupedFiles_CellEditFinishing(object sender, CellEditEventArgs e) { if (e.NewValue.ToString().Contains("/")) { e.Cancel = true; return; } foreach (tlvBranch item in ((tlvBranch)e.RowObject).Parent.Children) { if (item.Text == (string)e.NewValue) { e.Cancel = true; return; } } var rowObject = ((tlvBranch)e.RowObject); rowObject.Text = ((string)e.NewValue).Trim(); if (rowObject.Parent != null && rowObject.Data is SpectrumSourceGroup && rowObject.Parent.Data is SpectrumSourceGroup) { ((SpectrumSourceGroup)rowObject.Data).Name = (((SpectrumSourceGroup)rowObject.Parent.Data).Name + "/" + ((string)e.NewValue).Trim()).Replace("//", "/"); } }
private bool IsValidValue(CellEditEventArgs e) { var index = e.ListViewItem.Index; if (e.Column == dateColumn) { var newDate = Convert.ToDateTime(e.NewValue); if (index > 0 && newDate < Loan.InstallmentList[index - 1].ExpectedDate) { return(false); } if (index < Loan.InstallmentList.Count - 1 && newDate > Loan.InstallmentList[index + 1].ExpectedDate) { return(false); } } else if (e.Column == interestColumn) { decimal newInterest; return(decimal.TryParse(e.NewValue.ToString(), out newInterest) && newInterest >= Loan.InstallmentList[index].PaidInterests.Value); } else if (e.Column == principalColumn) { decimal newPrincipal; return(decimal.TryParse(e.NewValue.ToString(), out newPrincipal) && newPrincipal >= Loan.InstallmentList[index].PaidCapital.Value); } return(true); }
private void chipsListView_CellEditFinishing(object sender, CellEditEventArgs e) { _chipSelectionBox.Bounds = Rectangle.Empty; if (e.RowObject is Chip chip) { if (e.Column == chipsNameColumn && _chipSelectionBox.SelectedItem is KeyValuePair <int, Chip> selectedChip && chip.Type != selectedChip.Key) { chip.ChangeType(selectedChip.Key); e.NewValue = chip.Name; return; } if (e.Control is NumericUpDown numericUpDown) { if (e.Column == chipsLevelColumn) { chip.Level = (int)numericUpDown.Value; e.NewValue = chip.Level; return; } if (e.Column == chipsWeightColumn) { chip.Weight = (int)numericUpDown.Value; e.NewValue = chip.Weight; return; } } } e.Cancel = true; }
private void inventoryListView_CellEditStarting(object sender, CellEditEventArgs e) { var item = e.RowObject as Item; if (e.Column == itemNameColumn || e.Column == corpseItemNameColumn) { _itemSelectionBox.Bounds = e.CellBounds; if (item != null) { _itemSelectionBox.SelectedItem = Item.Items.FirstOrDefault(m => m.Key == item.Id); } else { _itemSelectionBox.SelectedIndex = 0; } e.AutoDispose = false; e.Control = _itemSelectionBox; } else if (item != null && e.Control is NumericUpDown numericUpDown) { numericUpDown.Minimum = 1; numericUpDown.Maximum = 99; numericUpDown.Value = Math.Min(99, Math.Max(1, item.Quantity)); } }
private void ListView_CellEditFinished(object sender, CellEditEventArgs e) { OLVColumn column = e.Column; object rowObject = e.RowObject; /* * if (AttrHelper.GetAttribute<JText>(SourceObjectType, column.AspectName) != null) * { * e.Cancel = true; * RefreshObject(rowObject); * //((ObjectListView)sender).RefreshItem(e.ListViewItem); * } */ try { Dm.Instance.SaveObject(e.RowObject); } catch (JValidationException ex) { dropLocker = true;//xak AppManager.ShowValidationErrorMessage(ex.ValidationResult, this); AttrHelper.SetPropertyValue(rowObject, column.AspectName, e.Value); RefreshObject(rowObject); e.Cancel = true; } catch (Exception ex) { Log.ShowError(ex); } }
private void etxt_uz_edit(EditableColumnBase sender, CellEditEventArgs e) { string cn = GetPointCN(e.Row); _LastPoint = cn; _LastString = GridPoints[e.Row].UnAdjZ; Kb.ShowRegular(this); }
private void echk_onbnd_CellEditBeginning(EditableColumnBase sender, CellEditEventArgs e) { string cn = GetPointCN(e.Row); _LastPoint = cn; _LastString = null; _PointEdited[_LastPoint] = true; Kb.Hide(this); }
private void etxt_pid_CellEditBeginning(EditableColumnBase sender, CellEditEventArgs e) { string cn = GetPointCN(e.Row); _LastPoint = cn; _LastString = GridPoints[e.Row].Index; Kb.ShowRegular(this); }
private void ecbo_qdm_CellEditBeginning(EditableColumnBase sender, CellEditEventArgs e) { string cn = GetPointCN(e.Row); _LastPoint = cn; _LastString = GridPoints[e.Row].QndmLink; Kb.Hide(this); }