Get the selection position and selection count of a text cell in EditMode?

Posted by: jhoover on 8 September 2017, 1:37 pm EST

  • Posted 8 September 2017, 1:37 pm EST

    During EditMode, I can read the entire contents of the active cell like this: mySpread.ActiveSheet.ActiveCell.Text


     Is there a way to find what where the selection point is and the number of characters selected?


     Thanks,


    Jeff

  • Replied 8 September 2017, 1:37 pm EST

    You can use the SelectionStart and SelectionLength properties.
  • Replied 8 September 2017, 1:37 pm EST

    BobM:
    You can use the SelectionStart and SelectionLength properties.


     What are those a property of? I'm using 3.0.2005.2005 and FarPoint.Win.Spread.Cell doesn't have those properties.


     


    Thanks,


    Jeff

  • Replied 8 September 2017, 1:37 pm EST

    Jeff,


    They are properties of the editor of your cell. You can query the EditingControl property of the Spread when the Spread goes into editmode to get this.

  • Replied 8 September 2017, 1:37 pm EST

    scotts:

    Jeff,


    They are properties of the editor of your cell. You can query the EditingControl property of the Spread when the Spread goes into editmode to get this.



     


    Could you give me a brief code example?

  • Replied 8 September 2017, 1:37 pm EST

    Jeff,


    Here is code to use the MouseUp event of the editor to find what was selected.


    Private Sub FpSpread1_EditModeOn(ByVal sender As Object, ByVal e As System.EventArgs) Handles FpSpread1.EditModeOn


    Dim c As FarPoint.Win.Spread.CellType.GeneralEditor


    c = FpSpread1.EditingControl


    AddHandler c.MouseUp, AddressOf mymouseup


    End Sub


    Public Sub mymouseup(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)


    Dim c As FarPoint.Win.Spread.CellType.GeneralEditor = CType(sender, FarPoint.Win.Spread.CellType.GeneralEditor)


    Debug.WriteLine(c.SelectionStart & " --- " & c.SelectionLength)


    End Sub

Need extra support?

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

Learn More

Forum Channels