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.

Context Menu Issue

Thread ID:

Created:

Updated:

Platform:

Replies:

23152 Jan 5,2005 01:39 PM Jan 5,2005 04:00 PM Windows Forms 3
loading
Tags: GridControl
Zubin Tiku
Asked On January 5, 2005 01:39 PM

I am currently building a user control that includes a Syncfusion Grid. I would like to allow users to select a set of one or more rows within the grid and then right click to view a context menu where they can take actions on the rows they have selected. Currently I am encountering difficulty figuring out how to configure the Grid so that right clicking for the context menu does not affect the selected rows. It seems that whatever I set the ListBoxSelectionMode of the grid to, the selection is invariably compromised and I cannot track down the event that is being raised that I need to handle to prevent this from happenning. Thanks for any help, Zubin

Administrator [Syncfusion]
Replied On January 5, 2005 02:13 PM

This property setting should prevent the right-click from clearing the selections. this.gridControl1.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left; If you want to control the context menus of active cell controls, you may need to use the technique discussed in this thread. http://64.78.18.34/Support/Forums/message.aspx?MessageID=13861

Zubin Tiku
Replied On January 5, 2005 02:45 PM

Is there any way of getting the Grid to behave like an Excel spreadsheet? I.E. When the user right clicks within a selected range of cells the selection is not affected, but if the user right clicks outside of a selected range of cells, the selection is updated?

Administrator [Syncfusion]
Replied On January 5, 2005 04:00 PM

If you want this behavior, do not set the SelectCellsMouseButtonMask. Instead, handle the SelectionsChanging event, and set e.Cancel = true if you right-click on selected cells.
Private Sub SelectionChanging(ByVal sender As Object, ByVal e As GridSelectionChangingEventArgs)
	If e.Reason = GridSelectionReason.MouseDown And Control.MouseButtons = MouseButtons.Right Then
		Dim row, col As Integer
		Dim pt As Point = Me.GridDataBoundGrid1.PointToClient(Control.MousePosition)
	If Me.GridDataBoundGrid1.PointToRowCol(pt, row, col, -1) Then
			Dim rangeList As GridRangeInfoList
			rangeList = Me.GridDataBoundGrid1.Selections.GetSelectedRows(True, False)
			If rangeList.AnyRangeIntersects(GridRangeInfo.Cell(row, col)) Then
				e.Cancel = True
			End If
		End If
	End If
End Sub

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.

;