Results 1 to 6 of 6

Thread: Current cursor position in a Rich Text Box

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    4

    Question Current cursor position in a Rich Text Box

    hi all,
    I have a problem to solve. I need the current cursor position of the Rich Text Box. If I use the RTb.SelStart, I am getting position of the cursor in Text content. But I want the position in RTF Content. Is there any way to get this ? Kindly help me !!

    Regards,
    Reshmi

  2. #2
    Lively Member okosv's Avatar
    Join Date
    Sep 2006
    Posts
    95

    Re: Current cursor position in a Rich Text Box

    MsgBox RichText1.SelStart
    SelStart property returns cursor position

  3. #3
    Lively Member okosv's Avatar
    Join Date
    Sep 2006
    Posts
    95

    Re: Current cursor position in a Rich Text Box

    SelRTF?

  4. #4
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Current cursor position in a Rich Text Box

    Hi Reshmi ! Welcome to the forums !


    Unfortunetly there is no straight way to get current cursor position from TextRTF. here is my idea. I hope it will give you some better ideas.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  5. #5
    Addicted Member
    Join Date
    Mar 2002
    Location
    Lithuania
    Posts
    165

    Re: Current cursor position in a Rich Text Box

    VB Code:
    1. 'in form
    2. Private Sub Timer1_Timer()
    3.     Dim PT As POINTAPI
    4.  
    5.     GetCaretPos PT
    6.  
    7.     Me.Caption = "X: " & PT.X & "  Y: " & PT.Y
    8.  
    9. End Sub
    10.  
    11. 'in module
    12. Public Declare Function GetCaretPos Lib "user32" (lpPoint As POINTAPI) As Long
    13.  
    14. Type POINTAPI
    15.     X As Long
    16.     Y As Long
    17. End Type
    18.  
    19. Public POINTAPI As POINTAPI
    P.S. Sorry for my poor English...

  6. #6
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Current cursor position in a Rich Text Box

    ...but that doesn't give you the insertion point in TextRTF. (Like SelStart is for .Text)
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


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