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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Hold the selection

Thread ID:

Created:

Updated:

Platform:

Replies:

47384 Aug 3,2006 05:00 PM UTC Aug 8,2006 09:03 AM UTC WinForms 4
loading
Tags: GridControl
Ravichandran
Asked On August 3, 2006 05:00 PM UTC

Hi,

In GridControl, after selectiing the range for a particular col and then clicking the right mouse button to display the popup menu, while doing so the selected or highlighted rage goes off. I cant hold it if i do right click on my mouse...

pls reply me asap

Thanks
ravi

Administrator [Syncfusion]
Replied On August 3, 2006 06:21 PM UTC

Try setting this property.

this.gridControl1.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;

Ravichandran
Replied On August 4, 2006 08:51 AM UTC

Hi

It works fine. We are displaying the context menu when right clicking the mouse buttion. But after setting
gridControl1.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left

I am not able to get the context menu if I do right click. But can hold the selection.


Code to display context menu:

private void gridCellClick(object sender, GridCellClickEventArgs e)
{
if ( e.MouseEventArgs.Button == MouseButtons.Left
&& e.RowIndex == 1 )
{
m_clickedHeader = true;
}
else
{
m_clickedHeader = false;
}
if ( e.MouseEventArgs.Button == MouseButtons.Right)
{
string cellType = this[e.RowIndex, e.ColIndex].CellType;
if (cellType != "ContextMenuCell" && cellType != "CustomButtonCell" && e.RowIndex > 1)
{
m_popupMenu.Show(this.GetCurrentCell().Grid, new Point(e.MouseEventArgs.X, e.MouseEventArgs.Y));
}
}
}



>Try setting this property.

this.gridControl1.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left

Administrator [Syncfusion]
Replied On August 8, 2006 07:12 AM UTC

Hi Ravi,

My apologies for the delayed response.
Please try the code below in the MouseUp event of the grid, this will help to display the contextmenu on right clicking the cells in the grid and not for the headers.

// gridcontrol''s MouseUp event
Point pt = new Point(e.X, e.Y);
int row, col;
if(e.Button == MouseButtons.Right && this.gridControl1.PointToRowCol(pt, out row, out col) && row > this.gridControl1.Model.Rows.HeaderCount && col > 0)
{
m_popupMenu.Show(this.gridControl1, pt);
}

Let me know if this does not help.
Thanks,
Rajagopal

Ravichandran
Replied On August 8, 2006 09:03 AM UTC

Hi,

I got the solution, but wrote it in mousedown event. Anyways thanks

Cheers
Ravi


>Hi Ravi,

My apologies for the delayed response.
Please try the code below in the MouseUp event of the grid, this will help to display the contextmenu on right clicking the cells in the grid and not for the headers.

// gridcontrol''s MouseUp event
Point pt = new Point(e.X, e.Y);
int row, col;
if(e.Button == MouseButtons.Right && this.gridControl1.PointToRowCol(pt, out row, out col) && row > this.gridControl1.Model.Rows.HeaderCount && col > 0)
{
m_popupMenu.Show(this.gridControl1, pt);
}

Let me know if this does not help.
Thanks,
Rajagopal

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

;