Free Support Forum - aspose.com

MouseUp (Aspose.Cells.GridDesktop)

I'm wanting to be able to disable context menu items on the mouseup event based upon the value of the cell that has focus.

However, I noticed it doesn't fire until after clicking in a different cell.

To see an example, add a GridDesktop to a form. Add the following event for MouseUp.

private void gridDesktop1_MouseUp(object sender, MouseEventArgs e)

{

Console.WriteLine("Clicked");

}

Run the application and right-click in a cell. Notice the "Clicked" does not show until you click in another cell.

Hi,

I don’t find the problem (using your code and scenario) regarding GridDesktop’s MouseUp event using the attached latest version. The event fires when the mouse button is clicked/released on a cell and you don’t need to click on other cell to fire it.

Please try the attached version, if you still find the issue, kindly do create a sample application, zip it and post it here to show the issue. We will check it soon.

Thank you.

In the attached example, run the application. Make sure that the first thing you do is to right-click in a cell versus clicking in a cell and then right-clicking in that newly selected cell.

There should be a break on the Console.Writeline. After right-clicking, when I run it, it doesn't hit the break point until after I click to a different cell.

Hi,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the sample application.

Your issue has been registered in our internal issue tracking system with issue id: CELLSNET-15792. We will further investigate your issue and get back to you soon.

Thank You & Best Regards,

Hi,

By the way, GridDesktop provides a property named “ShowContextMenu”. If it is set to false, the ContextMenu will be never shown when you right click on any cell. Should this fulfill your need.

Thank you.

No, I'm wanting to roll my own Copy and Paste as the one provided does not handle my current needs.

I want to be able to disable the Paste until the user has copied something, etc.

Hi,

We provide a property named “ContextMenu” of ContextMenuManager in Aspose.Cells.GridDesktop v2.1.0.2002(attached). To handle the popup event of ContextMenu is more efficient way than using mouseup event. Please try the following code:

private void Form1_Load(object sender, System.EventArgs e)

{

gridDesktop1.ContextMenuManager.ContextMenu.Popup += new EventHandler(ContextMenu_Popup);

}

void ContextMenu_Popup(object sender, EventArgs e)

{

gridDesktop1.ContextMenuManager.ContextMenu.MenuItems[1].Visible = false;

}