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. Image for the cookie policy date
close icon

Hold the selection

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

4 Replies

AD Administrator Syncfusion Team August 3, 2006 06:21 PM UTC

Try setting this property.

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


RA Ravichandran 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


AD Administrator Syncfusion Team 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


RA Ravichandran 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

Loader.
Live Chat Icon For mobile
Up arrow icon