Jump to content

_GUICtrlRichEdit_FindText for whole line


mike2003
 Share

Recommended Posts

I suggest you read each line one after the other with_GUICtrlRichEdit_GetTextInLine based on the number of lines obtained with _GUICtrlRichEdit_GetLineCount.  If there a match you got your line...

Edit I tested _GUICtrlRichEdit_FindText with @CR and it is working for me.  But the approach I suggested is more robust.

Edited by Nine
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>
Global $g_idLblMsg
Example()
Func Example()
    Local $hGui, $iMsg, $idBtnNext, $hRichEdit, $iStep = 0
    $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 300, 220, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    _GUICtrlRichEdit_SetFont($hRichEdit, 15, "Tahoma")
    $g_idLblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
    GUISetState(@SW_SHOW)

    _GUICtrlRichEdit_AppendText($hRichEdit, "This is a test.")
    _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "This is appended text.")
    _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "appended text")
    _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "appended text fjff")

    _GUICtrlRichEdit_SetSel($hRichEdit, 0, 0)
    $aa = _GUICtrlRichEdit_FindText($hRichEdit, "appended text" & @CR, True, False, True)
    _GUICtrlRichEdit_SetSel($hRichEdit, $aa, $aa + 13)
    GUICtrlSetData($g_idLblMsg, $aa)

    While True
        $iMsg = GUIGetMsg()
        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes
                Exit
        EndSelect
    WEnd
EndFunc   ;==>Example

I took an example from help, added lines and it doesn't work.

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...