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

Cut/Copy/Paste behavior in Gridcontrol

Thread ID:

Created:

Updated:

Platform:

Replies:

28155 Apr 25,2005 11:09 PM UTC Apr 28,2005 09:13 PM UTC Windows Forms 4
loading
Tags: GridControl
Jan Eugenides
Asked On April 25, 2005 11:09 PM UTC

We''re trying to get a certain behavior when cutting a range of rows from a Gridcontrol. After the cut is complete, we want the grid to collapse (i.e. we want the cut rows to disappear). We added some code to do a RemoveRange on the rows after the cut. This works, but has the unfortunate side effect of clearing the clipboard. How can we remove the range and still leave the data on the clipboard for later pasting? Thanks.

Administrator [Syncfusion]
Replied On April 26, 2005 02:14 AM UTC

How are you doing this? I derived the grid and used an OnKeyDownOverride to delete the selected rows when the user type ctl+X and the clipboard was not lost with that code.
public class MyGridControl : GridControl
{
	protected override void OnKeyDown(KeyEventArgs e)
	{
		Keys keyCode = e.KeyCode & Keys.KeyCode;
		bool controlKeyDown = (Control.ModifierKeys & Keys.Control) != Keys.None;
		GridRangeInfoList rangeList = this.Selections.GetSelectedRows(true, false);
		base.OnKeyDown (e);
		if(controlKeyDown && keyCode == Keys.X && rangeList.Count > 0)
		{
			this.Rows.RemoveRange(rangeList.ActiveRange.Top, rangeList.ActiveRange.Bottom);
		}
	}
}

Jan Eugenides
Replied On April 26, 2005 03:45 PM UTC

Well I''m doing the removerange at the ClipboardCut event. The cut can happen with or without a keydown event so putting it in keydown won''t work, will it? >How are you doing this? I derived the grid and used an OnKeyDownOverride to delete the selected rows when the user type ctl+X and the clipboard was not lost with that code. > >
>public class MyGridControl : GridControl
>{
>	protected override void OnKeyDown(KeyEventArgs e)
>	{
>		Keys keyCode = e.KeyCode & Keys.KeyCode;
>		bool controlKeyDown = (Control.ModifierKeys & Keys.Control) != Keys.None;
>		GridRangeInfoList rangeList = this.Selections.GetSelectedRows(true, false);
>		base.OnKeyDown (e);
>		if(controlKeyDown && keyCode == Keys.X && rangeList.Count > 0)
>		{
>			this.Rows.RemoveRange(rangeList.ActiveRange.Top, rangeList.ActiveRange.Bottom);
>		}
>	}
>}
>

Jan Eugenides
Replied On April 26, 2005 04:03 PM UTC

Oh - as long as I''m here -- what format does the Gridcontrol put onto the clipboard?

Administrator [Syncfusion]
Replied On April 28, 2005 09:13 PM UTC

Text/Unicode Format and also an internal format (a GridData object). You can control this with ClipboardFlags (see GridDragDropFlags.Text and GridDragDropFlags.Styles) Stefan >Oh - as long as I''m here -- what format does the Gridcontrol put onto the clipboard?

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

;