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.

ClipboardCanPaste is executed twice by the grid

Thread ID:

Created:

Updated:

Platform:

Replies:

36104 Oct 20,2005 03:16 AM Oct 20,2005 09:18 PM Windows Forms 5
loading
Tags: GridControl
I Gusti Ngurah Wirawan
Asked On October 20, 2005 03:16 AM

Hi, I have a problem where ClipboardCanPaste is executed twice by the grid when i call Ctrl-V. In menus in the form i had edit menu where contains Cut, Copy, Paste operation where each shorcut are Ctrl-X, Ctrl-C and Ctrl-V. In each submenus i add code to send keys to the control, like this: SendKeys.Send("^(V)"); How can i solve this problem? thanks wirawan

I Gusti Ngurah Wirawan
Replied On October 20, 2005 04:57 AM

attaching a sample of code.

WindowsApplication21.zip

Administrator [Syncfusion]
Replied On October 20, 2005 05:13 AM

Here is sample that has a ctl+V Paste menu item that works on the grid and the ClipboardCanPaste is only hit once for me using version 3.3. http://www.syncfusion.com/Support/user/uploads/GDBG_CtlV_40c5bd3c.zip

I Gusti Ngurah Wirawan
Replied On October 20, 2005 05:41 AM

thanks for your quick response. the problem is i must do as same as when i click the paste submenus as i do Ctrl-V to others control, so i use this code "SendKeys.Send("^(V)");". and when i add that code in your solution it still raise ClipboardCanPaste executed twice. any other idea that u can share with me. regards wirawan

Administrator [Syncfusion]
Replied On October 20, 2005 06:12 AM

In the sample I sent, the event was only hit once, correct? You can put a check in your CanPaste handler to only do your code once. Here is a handler that I used in your sample to only display th emessage box once.
private void DataBoundGridModel_ClipboardCanPaste(object sender, Syncfusion.Windows.Forms.Grid.GridCutPasteEventArgs e)
{
	e.Handled = true;
	bool controlKeyDown = (Control.ModifierKeys & Keys.Control) != Keys.None;
	if(controlKeyDown)
	{
		MessageBox.Show("can paste called");
	}
}

I Gusti Ngurah Wirawan
Replied On October 20, 2005 09:18 PM

Thanks Clay, its working.

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.

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.

;