Posted 27 September 2017, 11:58 am EST
Kevin,
When I put the code “int row= c1FlexGrid1.MouseRow
and int col=c1FlexGrid1.MouseCol” in my BeforeMouseDown event handler, The row, col is -1(0xffff) when i right click the mouse, even my mouse point is on the row of the grid, the left mouse click is working fine. What could be the problem?
“Kevin” wrote:
>
>
>The code below goes in the BeforeMouseDown event handler.
>
>“Kevin” wrote:
>>
>>
>>Here is the solution:
>> int row=c1FlexGrid1.MouseRow;
>> int col=c1FlexGrid1.MouseCol;
>>
>> if (e.Button==MouseButtons.Right && row > c1FlexGrid1.Rows.Fixed)
>> {
>> // Test by selection mode
>> if (c1FlexGrid1.SelectionMode == C1.Win.C1FlexGrid.SelectionModeEnum.ListBox)
>> {
>> // clicked on unselected row, so change selection.
>> if (!c1FlexGrid1.Rows[row].Selected)
>> {
>> c1FlexGrid1.Row=row;
>> }
>> }
>> else
>> {
>> if (!c1FlexGrid1.Selection.Contains(c1FlexGrid1.MouseRow,c1FlexGrid1.MouseCol))
>> {
>> c1FlexGrid1.Select(c1FlexGrid1.MouseRow, c1FlexGrid1.MouseCol);
>> }
>>
>> }
>> }
>>
>>
>>“Kevin” wrote:
>>>
>>>Hello,
>>>
>>>I have a grid working in SelectionModeEnum.ListBox mode.
>>>
>>>I have a ContextMenu on the grid.
>>>
>>>When user RightMouse Clicks I want the grid to select the row and popup the menu. Is this possible?
>>>
>>>* Like the behaviour of Microsoft Excel and Outlook *
>>>
>>>The row select must be smart, if user has selected multiple rows using left mouse and ctrl/shift then they right click it should not change the row selection.
>>
>