UDF > GUI > GuiRichEdit >


_GUICtrlRichEdit_GetTextInLine

Obtient une ligne de texte

#include <GuiRichEdit.au3>
_GUICtrlRichEdit_GetTextInLine ( $hWnd, $iLine )

Paramètres

$hWnd Handle du contrôle
$iLine Numéro de la ligne à retourner

Valeur de retour

Succès: Retourne le texte de la ligne.
Échec: Définit @error <> 0.
@error: 101 - $hWnd n'est pas un handle
1021 - $iLine n'est pas un nombre positif
1022 - $iLine dépasse le nombre de lignes du contrôle
700 - erreur interne

Remarque

La première ligne d'un contrôle porte le numéro 1.

En relation

_GUICtrlRichEdit_GetSel, _GUICtrlRichEdit_GetTextInRange

Voir aussi

Consultez EM_GETLINE dans la librairie MSDN.

Exemple

#include <GUIConstantsEx.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>

Global $g_idLblMsg

Example()

Func Example()
    Local $hGui, $iMsg, $hRichEdit
    $hGui = GUICreate("Exemple (" & StringTrimRight(@ScriptName, 4) & ")", 320, 350, -1, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGui, "Ceci est un test.", 10, 10, 300, 220, _
            BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    $g_idLblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60)
    GUISetState(@SW_SHOW)

    _GUICtrlRichEdit_SetText($hRichEdit, "Ceci est un test." & @CRLF & "Davantange de texte sur une autre ligne")
    Report(_GUICtrlRichEdit_GetTextInLine($hRichEdit, 1))

    While GUIGetMsg() <> $GUI_EVENT_CLOSE
    Wend

    _GUICtrlRichEdit_Destroy($hRichEdit) ; Nécessaire sauf si le script se bloque
    ; GUIDelete(); est OK aussi
    WEnd
EndFunc   ;==>Example

Func Report($sMsg)
    GUICtrlSetData($g_idLblMsg, $sMsg)
EndFunc   ;==>Report