Function Reference


_GUICtrlRichEdit_SetTabStops

Sets tab stops for the control

#include <GuiRichEdit.au3>
_GUICtrlRichEdit_SetTabStops ( $hWnd, $vTabStops [, $bRedraw = True] )

Parameters

$hWnd handle of control
$VTabStops tab stop(s) to set in space units:
If a string, semicolon-separated tab stop positions
If numeric: set a tab stop every space units
$bRedraw [optional] whether to redraw the control - True (default) or False

Return Value

Success: True.
Failure: False and sets the @error flag to non-zero.
@error: 101 - $hWnd is not a handle
103 - $bRedraw must be True or False
1021 - $vTabStops is neither a string nor a number
1022 - $vTabStops is a string but a tab stop in it is not a positive number
1023 - $vTabStops is an empty string
1024 - $vTabStops is a number but it is zero or negative

Remarks

Space units are initially inches.
To enter a tab into a control, press Ctrl_Tab.

Related

_GUICtrlRichEdit_SetParaTabStops, _GUICtrlRichEdit_SetSpaceUnit

See Also

Search EM_SETTABSTOPS in MSDN Library.

Example

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

Example()

Func Example()
    Local $hGui, $iMsg, $idBtn_Next, $iStep = 0
    Local $idLbl_Msg, $hRichEdit
    $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))
    $idLbl_Msg = GUICtrlCreateLabel("", 10, 235, 300, 60)
    $idBtn_Next = GUICtrlCreateButton("Next", 270, 310, 40, 30)
    GUISetState(@SW_SHOW)

    _GUICtrlRichEdit_SetText($hRichEdit, "Paragraph 1" & @TAB & "Paragraph 2" & @TAB & "Paragraph 3")
    While True
        $iMsg = GUIGetMsg()
        Select
            Case $iMsg = $GUI_EVENT_CLOSE
                _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes
                ; GUIDelete()   ; is OK too
                Exit
            Case $iMsg = $idBtn_Next
                $iStep += 1
                Switch $iStep
                    Case 1
                        _GUICtrlRichEdit_SetTabStops($hRichEdit, 1)
                        GUICtrlSetData($idLbl_Msg, "1. Set tab stops every inch")
                    Case 2
                        _GUICtrlRichEdit_SetTabStops($hRichEdit, "0.5;1.5")
                        GUICtrlSetData($idLbl_Msg, "2. Set tab stops at 0.5 and 1.5 inches")

                        ; Stream all text to the Desktop so you can look at settings in Word
                        _GUICtrlRichEdit_Deselect($hRichEdit)
                        _GUICtrlRichEdit_StreamToFile($hRichEdit, @DesktopDir & "\gcre.rtf")
                        GUICtrlSetState($idBtn_Next, $GUI_DISABLE)
                EndSwitch
        EndSelect
    WEnd
EndFunc   ;==>Example