protected void OnSubItemEndEditing(SubItemEndEditingEventArgs e) { if (SubItemEndEditing != null) { SubItemEndEditing(this, e); } }
/// <summary> /// Accept or discard current value of cell editor control /// </summary> /// <param name="AcceptChanges">Use the _editingControl's Text as new SubItem text or discard changes?</param> public void EndEditing(bool AcceptChanges) { if (_editingControl == null) { return; } SubItemEndEditingEventArgs e = new SubItemEndEditingEventArgs( _editItem, // The item being edited _editSubItem, // The subitem index being edited AcceptChanges ? _editingControl.Text : // Use editControl text if changes are accepted _editItem.SubItems[_editSubItem].Text, // or the original subitem's text, if changes are discarded !AcceptChanges // Cancel? ); OnSubItemEndEditing(e); if (!string.IsNullOrEmpty(e.DisplayText)) { _editItem.SubItems[_editSubItem].Text = e.DisplayText; } _editingControl.Leave -= new EventHandler(_editControl_Leave); _editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress); _editingControl.Visible = false; _editingControl = null; _editItem = null; _editSubItem = -1; }
private void lvFTPList_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) { if (lvFTPList.SelectedItems.Count > 0 && !e.Cancel && !string.IsNullOrEmpty(e.DisplayText)) { FtpItem file = (FtpItem)lvFTPList.SelectedItems[0].Tag; if (file.Name != e.DisplayText) { FTPAdapter.Rename(file.FullPath, FTPHelpers.CombineURL(currentDirectory, e.DisplayText)); RefreshDirectory(); } } }
protected void OnSubItemEndEditing(SubItemEndEditingEventArgs e) { if (SubItemEndEditing != null) SubItemEndEditing(this, e); }
/// <summary> /// Accept or discard current value of cell editor control /// </summary> /// <param name="AcceptChanges">Use the _editingControl's Text as new SubItem text or discard changes?</param> public void EndEditing(bool AcceptChanges) { if (_editingControl == null) return; SubItemEndEditingEventArgs e = new SubItemEndEditingEventArgs( _editItem, // The item being edited _editSubItem, // The subitem index being edited AcceptChanges ? _editingControl.Text : // Use editControl text if changes are accepted _editItem.SubItems[_editSubItem].Text, // or the original subitem's text, if changes are discarded !AcceptChanges // Cancel? ); OnSubItemEndEditing(e); if (!string.IsNullOrEmpty(e.DisplayText)) { _editItem.SubItems[_editSubItem].Text = e.DisplayText; } _editingControl.Leave -= new EventHandler(_editControl_Leave); _editingControl.KeyPress -= new KeyPressEventHandler(_editControl_KeyPress); _editingControl.Visible = false; _editingControl = null; _editItem = null; _editSubItem = -1; }