/// <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 -= _editControl_Leave; _editingControl.KeyPress -= _editControl_KeyPress; _editingControl.Visible = false; _editingControl = null; _editItem = null; _editSubItem = -1; }
protected void OnSubItemEndEditing(SubItemEndEditingEventArgs e) { if (SubItemEndEditing != null) { SubItemEndEditing(this, e); } }
private void lvFTPList_SubItemEndEditing(object sender, SubItemEndEditingEventArgs e) { if (lvFTPList.SelectedItems.Count > 0 && !e.Cancel && !string.IsNullOrEmpty(e.DisplayText)) { FtpListItem file = (FtpListItem)lvFTPList.SelectedItems[0].Tag; if (file.Name != e.DisplayText) { Client.Rename(file.FullName, URLHelpers.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 -= _editControl_Leave; _editingControl.KeyPress -= _editControl_KeyPress; _editingControl.Visible = false; _editingControl = null; _editItem = null; _editSubItem = -1; }