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.
Syncfusion Feedback

TableControlCellMouseUp and ContextMenu with GridGroupingcontrol

Thread ID:

Created:

Updated:

Platform:

Replies:

19524 Sep 28,2004 09:12 AM Sep 28,2004 09:58 AM Windows Forms 1
loading
Tags: GridControl
Albert Gao
Asked On September 28, 2004 09:12 AM

Initially I assigned a contextmenu to the GridGroupingControl. It worked fine. Since I need to differentiate if the context menu is on column header/regular cell/blank area, I added TableControlCellMouseUp handler. I found the context menu is not working after the handler is added. I can popup the context menu in header/cell, but I have no way to popup it in blank area. what''s the proper way to popup context menu in any situation? Thanks, albert

Administrator [Syncfusion]
Replied On September 28, 2004 09:58 AM

Currently, I think you will have to handle 2 events to catch both these situations. The grid.TableControl.MouseUp will catch the click where there are no cells.
this.gridGroupingControl1.TableControlCellMouseUp += new Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellMouseEventHandler(gridGroupingControl1_TableControlCellMouseUp);
this.gridGroupingControl1.TableControl.MouseUp += new MouseEventHandler(TableControl_MouseUp);

private bool TableControlCellMouseUpHit = false;

private void gridGroupingControl1_TableControlCellMouseUp(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellMouseEventArgs e)
{
	if(e.Inner.MouseEventArgs.Button == MouseButtons.Right)
	{
		TableControlCellMouseUpHit = true;
		this.contextMenu1.Show(this.gridGroupingControl1, 
			this.gridGroupingControl1.PointToClient(Control.MousePosition));
	}
}

private void TableControl_MouseUp(object sender, MouseEventArgs e)
{
	if(!TableControlCellMouseUpHit && e.Button == MouseButtons.Right)
		this.contextMenu1.Show(this.gridGroupingControl1, 
			this.gridGroupingControl1.PointToClient(Control.MousePosition));
	TableControlCellMouseUpHit = false;
}

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

;