Function Reference


_GUICtrlRichEdit_Create

Create an Edit control

#include <GuiRichEdit.au3>
_GUICtrlRichEdit_Create ( $hWnd, $sText, $iLeft, $iTop [, $iWidth = 150 [, $iHeight = 150 [, $iStyle = -1 [, $iExStyle = -1]]]] )

Parameters

$hWnd Handle to parent or owner window
$sText Text to be displayed in the control
$iLeft Horizontal position of the control
$iTop Vertical position of the control
$iWidth [optional] Control width
$iHeight [optional] Control height
$iStyle [optional] Control styles:
    $ES_AUTOHSCROLL - Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line.
    $ES_AUTOVSCROLL - Automatically scrolls text up one page when the user presses the ENTER key on the last line.
    $WS_HSCROLL - Control has horizontal scroll bar
    $WS_VSCROLL - Control has vertical scroll bar
    $ES_CENTER - Centers text in an edit control.
    $ES_LEFT - Aligns text with the left margin.
    $ES_MULTILINE - Generates a multi-line control (Default)
    $ES_NOHIDESEL - The selected text is inverted, even if the control does not have the focus.
    $ES_NUMBER - Allows only digits to be entered into the edit control.
    $ES_READONLY - Prevents the user from typing or editing text in the edit control.
    $ES_RIGHT - Right-aligns text edit control.
    $ES_WANTRETURN - Specifies that a carriage return be inserted when the user presses the ENTER key. (Default)
    $ES_PASSWORD - Displays an asterisk (*) for each character that is typed into the edit control

Default: 0
Forced : WS_CHILD, $WS_VISIBLE, $WS_TABSTOP unless $ES_READONLY
$iExStyle [optional] Control extended style. These correspond to the standard $WS_EX_* constants. See Extended Style Table.

Return Value

Success: the handle to the Rich Edit control.
Failure: 0 and sets the @error flag to non-zero.
@error: 105 - $iWidth is neither a positive number nor -1
106 - $iHeight is neither a positive number nor -1
107 - $iStyle is is neither a positive number nor zero nor -1
108 - $iExStyle is is neither a positive number nor zero nor -1

Related

_GUICtrlRichEdit_Destroy

Example

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

Example()

Func Example()
        Local $hGui, $hRichEdit, $iMsg
        $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1)
        $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _
                        BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
        _GUICtrlRichEdit_AppendText($hRichEdit, @CRLF & "This is more text")
        GUISetState(@SW_SHOW)

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