Function Reference


_GUICtrlEdit_FmtLines

Determines whether an edit control includes soft line-break characters

#include <GuiEdit.au3>
_GUICtrlEdit_FmtLines ( $hWnd [, $bSoftBreak = False] )

Parameters

$hWnd Control ID/Handle to the control
$bSoftBreak [optional] Specifies whether soft line-break characters are to be inserted:
    True - Inserts the characters
    False - Removes them

Return Value

Returns identical to the $bSoftBreak parameter.

Remarks

A soft line break consists of two carriage returns and a line feed and is inserted at the end of a line that is broken because of wordwrapping.

This function affects only the text returned by the _GUICtrlEdit_GetText() function.

It has no effect on the display of the text within the edit control.

The _GUICtrlEdit_FmtLines() function does not affect a line that ends with a hard line break.
A hard line break consists of one carriage return and a line feed.

Example

#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
        Local $idEdit
        Local $sWow64 = ""
        If @AutoItX64 Then $sWow64 = "\Wow6432Node"
        Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\_ReadMe_.txt"
        Local $sBefore, $sAfter

        ; Create GUI
        GUICreate("Edit FmtLines", 400, 300)
        $idEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
        GUISetState(@SW_SHOW)

        ; Set Text
        _GUICtrlEdit_SetText($idEdit, FileRead($sFile, 500))

        ; Text retrieved in default format
        $sBefore = _GUICtrlEdit_GetText($idEdit)

        ; insert soft line-breaks
        _GUICtrlEdit_FmtLines($idEdit, True)

        ; Text with soft line breaks
        $sAfter = _GUICtrlEdit_GetText($idEdit)

        MsgBox($MB_SYSTEMMODAL, "Information", "Before:" & @CRLF & @CRLF & $sBefore & @CRLF & _
                        '--------------------------------------------------------------' & @CRLF & _
                        "After:" & @CRLF & @CRLF & $sAfter)

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>Example