We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

pasting values into a summary cell

I''m having a problem with pasting values into editable summary cells. My summary cell is a textbox cell type (col.Appearance.AnyCell.CellType = "TextBox";). I''m trying to paste a value into that cell. All of my pasting needs to be done via ctrl-v. If the cell I''m trying to paste into is the grid''s current/highlighted cell and there is no cursor blinking in the cell, I''m able to paste with no problems (replacing the old value). If there is a cursor blinking in the cell I''m trying to paste to, I can paste, but the the new data is added to the cell, but the old data remains as well. If I highlight the data in the cell and try pasting, nothing happens. How can I paste into a cell, replacing the old value in the last 2 scenarios? Thanks.

4 Replies

AA Anthony Avella July 17, 2005 07:31 PM

What is the status of this??? >I''m having a problem with pasting values into editable summary cells. My summary cell is a textbox cell type (col.Appearance.AnyCell.CellType = "TextBox";). I''m trying to paste a value into that cell. All of my pasting needs to be done via ctrl-v. > >If the cell I''m trying to paste into is the grid''s current/highlighted cell and there is no cursor blinking in the cell, I''m able to paste with no problems (replacing the old value). > >If there is a cursor blinking in the cell I''m trying to paste to, I can paste, but the the new data is added to the cell, but the old data remains as well. > >If I highlight the data in the cell and try pasting, nothing happens. > >How can I paste into a cell, replacing the old value in the last 2 scenarios? > >Thanks. >


AD Administrator Syncfusion Team July 18, 2005 04:31 AM

When the cell is actively editing, it is the cell control that handles the keys and would manage the paste. I am not sure what you are doing to get editable summary cells, but for editable recordfieldcells, handling TableControlCurentCellControlKeyMessage allows you to catch the ctl+V and handle teh paste.
private void gridGroupingControl1_TableControlCurrentCellControlKeyMessage(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCurrentCellControlKeyMessageEventArgs e)
{
	Keys keyCode = (Keys) ((int)e.Inner.Msg.WParam) & Keys.KeyCode;
	if(e.Inner.Msg.Msg == 0x100 && keyCode == Keys.V && 0 != (Control.ModifierKeys & Keys.Control))
	{
		GridTextBoxCellRenderer cr = e.TableControl.CurrentCell.Renderer  as GridTextBoxCellRenderer;
		if(cr != null && cr.TextBox.Text.Length == cr.TextBox.SelectionLength)
		{
			if(Clipboard.GetDataObject().GetDataPresent(typeof(string)))
			{
				string s = (string)Clipboard.GetDataObject().GetData(typeof(string));
				cr.TextBox.SelectedText = s;
				e.Inner.Handled = true;
				e.Inner.Result = true;
			}
		}
	}
}


AA Anthony Avella July 21, 2005 08:07 AM

Thanks. This solution works for 2 out of 3 scenarios. The only scenario it does not work for is: If there is a cursor blinking in the summary/caption cell I''m trying to paste to, I can paste, but the the new data is added to the cell, but the old data remains as well. Any ideas?


AD Administrator Syncfusion Team July 21, 2005 06:23 PM

Try this. Instead of cr.TextBox.SelectedText = s; Try cr.TextBox.SelectedAll(); cr.TextBox.SelectedText = s;

Loader.
Live Chat Icon For mobile
Up arrow icon