Skip to content

Is there a way to find out where the caret index is in TextEdit or LineEdit? #5123

Closed Answered by maxenko
maxenko asked this question in Q&A
Discussion options

You must be logged in to vote

Ok found it. This is not documented unless you dig through the source (or pay more attention to intellisense, as I should have).

TextInput has:
self.cursor-position-byte-offset
self.anchor-position-byte-offset

TextInput {
    text: "Hello World";
    
    cursor-position-changed(p) => {
        debug(self.cursor-position-byte-offset);
    }
}

Replies: 3 comments 12 replies

Comment options

You must be logged in to vote
12 replies
@maxenko
Comment options

@syf20020816
Comment options

@maxenko
Comment options

@syf20020816
Comment options

@maxenko
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by maxenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants