Results 1 to 5 of 5

Thread: How to get cursor position in a RichTextControl ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    66

    Question

    I would like to know how can I get the cursor position in a RichTextControl using SendMessage API.

    In fact, I want to get the column position of the cursor in the current line.

    Many thanks,
    Thierry

  2. #2
    Guest
    You can use the GetLineFromChar method.
    Code:
    iLine = RichTextBox1.GetLineFromChar(RichTextBox1.SelStart) + 1

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    66

    This is not what I want...

    I know how to get the current line.

    What I would like to know is the number of characters from the begin of the current line !...

    Example :


    This is
    my text

    If the cursor is between the 't' and 'e' letters of 'text' word, I would like to get the position '5'.

    Many Thanks,
    Thierry

  4. #4
    Guest
    Try this:

    Code:
    MsgBox Len(Left(Text1.Text, Text1.SelStart))

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    66

    Not what I want !...

    This give you the position from the beginning of the text.
    If my current line is 2, I want to get the position from the beginning of line # 2.

    Thanks,
    Thierry

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width