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

Context menu will not show unless right-click occured on a selected record. Please help.

Thread ID:

Created:

Updated:

Platform:

Replies:

55810 Feb 5,2007 05:19 PM UTC Feb 5,2007 06:47 PM UTC WinForms 1
loading
Tags: Grouping
James Blibo
Asked On February 5, 2007 05:19 PM UTC

I want to accomplish the following...

1. I have a grid in which I want to be able to multi-select rows.
2. I want to maintain my selection when I do a right-click on the ggc so that I can take some actions on the the selected records.
3. I also want to maintain my selection unless a certain column index are clicked. For example, if I have 5 columns, only the last two columns should toggle my selection.
4. I want to be able to right-clicked on ANY row and bring up the context menu.


I have the following settings..
this.gridGroupingControl2.TableControl.Selections.Clear();
this.gridGroupingControl2.TableOptions.AllowSelection = GridSelectionFlags.None;
this.gridGroupingControl2.TableOptions.ListBoxSelectionMode = SelectionMode.MultiSimple;
this.gridGroupingControl2.TableModel.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;


I am handling the following event for my context menu....

private void gridGroupingControl2_TableControlCellClick(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex, e.Inner.ColIndex];
if (style.TableCellIdentity.ColIndex == 1 && style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell)
e.Inner.Cancel = true;

if (e.Inner.MouseEventArgs.Button == MouseButtons.Right)
{
int row, col;
Point pt = new Point(e.Inner.MouseEventArgs.X, e.Inner.MouseEventArgs.Y);
if (e.TableControl.PointToRowCol(pt, out row, out col))
e.TableControl.CurrentCell.AdjustRowColIfCoveredCell(ref row, ref col);

tableCellStyle = e.TableControl.GetTableViewStyleInfo(row, col);
contextElement = tableCellStyle.TableCellIdentity.DisplayElement;

this.contextMenu.Items.Clear();
if (contextElement is GridRecordRow)
{
this.contextMenu.Items.Add("Combine", null, new EventHandler(on_item_clicked));
this.contextMenu1.Show(this, this.PointToClient(Control.MousePosition));
}

}



... however, the context menu will not come up until I right-click in the CURRENT cell of the CURRENTLY selected row.

When I right click on a row that is not selected, nothing happens.

I want to be able to right click anywhere on the grid and bring up the context menu.

Please help!


James Blibo
Replied On February 5, 2007 06:47 PM UTC

Never mind this... I've decided to use a checkbox celltype instead of relying on the ggc Selection.

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

;