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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

pasting values into a summary cell

Thread ID:

Created:

Updated:

Platform:

Replies:

31780 Jul 14,2005 11:54 AM UTC Jul 21,2005 11:23 PM UTC Windows Forms 4
loading
Tags: Grouping
Anthony Avella
Asked On July 14, 2005 11:54 AM UTC

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.

Anthony Avella
Replied On July 18, 2005 12:31 AM UTC

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. >

Administrator [Syncfusion]
Replied On July 18, 2005 09:31 AM UTC

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;
			}
		}
	}
}

Anthony Avella
Replied On July 21, 2005 01:07 PM UTC

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?

Administrator [Syncfusion]
Replied On July 21, 2005 11:23 PM UTC

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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;