Context Menu, Right-Clicked and ListBoxSelectionMode Help

I have a ggc that behaves as a listview thru the settings below...


this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.None;
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiSimple; // One;
this.gridGroupingControl1.TableOptions.ListBoxSelectionCurrentCellOptions = GridListBoxSelectionCurrentCellOptions.HideCurrentCell;

...I want to click on a row and select that row and click on the same row to unselect it. Everything works fine. I want to click anywhere in the ggc and bring up a context menu to operate on the SelectedRecords. ... so I filter out the mouse click with the settings below...

this.gridGroupingControl1.TableModel.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;


However, the context menu is behaving sporadically. It would only come up when the right click occurs on a selected row. Secondly, it would not come up when I right click the same row twice.

Please help!

1 Reply

AD Administrator Syncfusion Team February 2, 2007 08:58 PM UTC

Hi James,

Thanks for being patience.

This can be achieved by handling the TableControlMouseDown event and accordingly showing the context menu popup on the respective co-ordinates.

In the following code snippet, the TableControlMouseDown event is handled and context menu is shown only for the RecordFieldCell
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
GridTableCellStyleInfo styleinfo = e.TableControl.PointToTableCellStyle(new Point(e.Inner.X, e.Inner.Y));
if(e.Inner.Button == MouseButtons.Right && styleinfo.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell)
{
// show contextmenu1
this.contextMenu1.Show(this.gridGroupingControl1, this.gridGroupingControl1.PointToClient(Control.MousePosition));
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Sample:
http://www.syncfusion.com/Support/user/uploads/ContextMenu_GGC_b6135ab.zip

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

Loader.
Up arrow icon