UDF > GUI > GuiRichEdit >


_GUICtrlRichEdit_SetText

Définit le texte d'un contrôle

#include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetText ( $hWnd, $sText )

Paramètres

$hWnd Handle du contrôle
$sText Texte brut ou RTF à mettre dans le contrôle

Valeur de retour

Succcess: Retourne True.
Échec: Retourne False et définit @error <> 0.
@error: 101 - $hWnd n'est pas un handle

Remarque

Définit tout le texte. Le texte peut être du texte brut ou RTF.
Maintient la pile d'annulation.

En relation

_GUICtrlRichEdit_AppendText, _GUICtrlRichEdit_EmptyUndoBuffer, _GUICtrlRichEdit_GetText, _GUICtrlRichEdit_InsertText, _GUICtrlRichEdit_ReplaceText

Exemple

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

Example()

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

    _GUICtrlRichEdit_SetText($hRichEdit, "Premier paragraphe")


    While GUIGetMsg() <> $GUI_EVENT_CLOSE
    Wend

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