determine SelectionStart in Listbox TextArea

  1. 2 weeks ago

    How can I determine the cursor position in a text, hence the SelectionStart, in Listbox.CellTypes.TextArea ?

    Me.ActiveCell returns the active cell, you will need to cast it to use it so this is the syntax:

    TextField(Me.ActiveCell).SelectionStart

    for example, in CellTextChange put:

    system.DebugLog(str(TextField(Me.ActiveCell).SelectionStart))

    to display the value in the messages window of the IDE during debug.

    EDIT

    Or you could use

    system.DebugLog(str(Me.ActiveTextControl.SelectionStart))

    if you don't want the hassle of casting.

  2. Julian S

    Mar 21 Pre-Release Testers, Xojo Pro Answer UK
    Edited 2 weeks ago

    Me.ActiveCell returns the active cell, you will need to cast it to use it so this is the syntax:

    TextField(Me.ActiveCell).SelectionStart

    for example, in CellTextChange put:

    system.DebugLog(str(TextField(Me.ActiveCell).SelectionStart))

    to display the value in the messages window of the IDE during debug.

    EDIT

    Or you could use

    system.DebugLog(str(Me.ActiveTextControl.SelectionStart))

    if you don't want the hassle of casting.

  3. You're a hero, Julian! Thanks a lot. Do you know, by any chance, if there is a way to determine the total number of characters in a TextArea or TextField anyways?

  4. Oh, with a little fiddling about: Me.ActiveTextControl.Value.bytes

or Sign Up to reply!