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.

Context menu location change

Thread ID:

Created:

Updated:

Platform:

Replies:

37923 Dec 2,2005 12:58 AM Dec 8,2005 07:40 AM Windows Forms 6
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On December 2, 2005 12:58 AM

Hi, I am using Essential Suite 2.0.5.1 I am having a context menu associated with the Syncfusion.Windows.Forms.Grid.GridControl. The GridControl has multiple rows and columns, I can select a cell by left click on mouse, and if I right click there then able to see the context menu on selected cell (current cell). However, if I right click somewhere outside the cell (but with in the Grid Control) then the context menu displayed on location of mouse cursor. How can I show the context menu on selected cell (current cell) instead of on cursor position? Is there any way to change the location of the context menu in either ContextMenu_PopUp event or other method? Thanks in advance Dhans

Administrator [Syncfusion]
Replied On December 2, 2005 08:06 AM

Here is a little sample that positions a context menu (and the mouse cursor) in the middle of the current cell if you right click outside it. It also sets the contextmenu in the middle of a selected range of cells if you right click out side of the selection. Maybe something like this will work for you. http://www.syncfusion.com/Support/user/uploads/GC_ContextMenu_60da496f.zip

Administrator [Syncfusion]
Replied On December 8, 2005 04:04 AM

Clay, Thanks for that reply. Now, my requirement is, change the current cell to mouse cursor position when i right click inside the grid.

stanleyj [Syncfusion]
Replied On December 8, 2005 05:11 AM

Hi Dhans, You can move the current cell by getting the respective row, column of the cursor position by calling the PointToRowCol function. Here is the modified sample and the necessary codes are below. this.gridControl1.PointToRowCol(pt, out row, out col); this.gridControl1.CurrentCell.MoveTo(row, col); Regards, Stanley

Administrator [Syncfusion]
Replied On December 8, 2005 05:30 AM

Thanks Stanley, Already I have selected multiple cells, Then If I try to move the CurrentCell then the selections cleared. How to I retain the Selections of the GridControl?

stanleyj [Syncfusion]
Replied On December 8, 2005 06:53 AM

Hi Dhans, How are the selections getting cleared? The selections are not cleared when moving with arrow keys or with right mouse click. Regards, Stanley

Administrator [Syncfusion]
Replied On December 8, 2005 07:40 AM

Thanks Stanley, Now its works fine for me.

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.

;