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.

Hold the selection

Thread ID:

Created:

Updated:

Platform:

Replies:

47384 Aug 3,2006 01:00 PM Aug 8,2006 05:03 AM Windows Forms 4
loading
Tags: GridControl
Ravichandran
Asked On August 3, 2006 01:00 PM

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 02:21 PM

Try setting this property.

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

Ravichandran
Replied On August 4, 2006 04:51 AM

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 03:12 AM

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 05:03 AM

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.

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.

;