Jump to content

Function to Read Lines Of RichEdit Not Working


Recommended Posts

I need to read a certain number of lines (rather than selected text, or text between known character indeces) of a RichEdit control. Here is my attempt at a function to do so (the below uses existing function from Gary Frost's script):

Func _GuiCtrlRichEditGetLines($h_RichEdit, $lineStart, $lineEnd)
    $start = _GUICtrlRichEditLineIndex($h_RichEdit, $lineStart)
    $end = _GUICtrlRichEditLineIndex($h_RichEdit, $lineEnd) + _GUICtrlRichEditLineLength($h_RichEdit, $lineEnd) -1
    If $start >= $end Then
        Return ""
    Else
        Return _GUICtrlRichEditGetText($h_RichEdit, $start, $end)
    EndIf
EndFunc

If the text box has many lines, and I read a small portion of them, the above kind of works. If I read 5 lines, it will return anywhere from 5-7 lines. However, if I want to read ALL lines (0 to TotalLines-1), it will not work. When I attempt this sometimes it returns nothing, sometimes a single word or so.

Can anyone correct the above function so that it does what I am intending?

Thanks

gm

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...