Row Select

Posted by: rossmc on 8 September 2017, 2:13 pm EST

  • Posted 8 September 2017, 2:13 pm EST

    I have a spread with a single sheet. To get the appearance and behaviour correct I have created my own columnheader renderer and focus renderer. Further to this the OperationMode of the sheet is SingleSelect.

    Unfortunately a right-click does not select a new row? In other words if I right-click on the sheet the row selection highlight does not move to the new row. As I'm sure hundreds have trtied to do before me, I want to have a context menu popup that is specific to the row the user right-clicked on, therefore I first need to get the row highlighted, then show my context menu.

    How do I programmatically select a row when in SingleSelect mode? 

    Thanks 

  • Replied 8 September 2017, 2:13 pm EST

    Hello,


    You can use the CellClick event to notify you of a right click in the Spread. Then you can programatically select the row you want in the Spread.


     Private Sub FpSpread1_CellClick(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick
      If e.Button = Windows.Forms.MouseButtons.Right Then
       FpSpread1.Sheets(0).ClearSelection()
       FpSpread1.Sheets(0).SetActiveCell(e.Row, e.Column)
       FpSpread1.Sheets(0).Models.Selection.SetSelection(e.Row, 0, 1, 1)
      End If
     End Sub

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels