Function Reference


_GUICtrlEdit_SetMargins

Sets the widths of the left and right margins

#include <GuiEdit.au3>
_GUICtrlEdit_SetMargins ( $hWnd [, $iMargin = 0x1 [, $iLeft = 0xFFFF [, $iRight = 0xFFFF]]] )

Parameters

$hWnd Control ID/Handle to the control
$iMargin [optional] Can be one or more of the following
    $EC_LEFTMARGIN - Sets the left margin
    $EC_RIGHTMARGIN - Sets the right margin

Default: $EC_LEFTMARGIN
$iLeft [optional] The new width of the left margin

Default: $EC_USEFONTINFO
$iRight [optional] The new width of the right margin

Default: $EC_USEFONTINFO

Return Value

Returns an array in the following format:
    [0] - The width of the left margin
    [1] - The width of the right margin

Related

_GUICtrlEdit_GetMargins

Example

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

Example()

Func Example()
        Local $sWow64 = ""
        If @AutoItX64 Then $sWow64 = "\Wow6432Node"
        Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\_ReadMe_.txt"
        Local $aPartRightSide[3] = [190, 378, -1], $aMargins

        ; Create GUI
        Local $hGUI = GUICreate("Edit Get/Set Margins (v" & @AutoItVersion & ")", 400, 300)
        Local $idEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
        Local $hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
        _GUICtrlStatusBar_SetIcon($hStatusBar, 2, 97, "shell32.dll")
        GUISetState(@SW_SHOW)

        ; Set Margins
        _GUICtrlEdit_SetMargins($idEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

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

        ; Get Margins
        $aMargins = _GUICtrlEdit_GetMargins($idEdit)
        _GUICtrlStatusBar_SetText($hStatusBar, "Left Margin: " & $aMargins[0])
        _GUICtrlStatusBar_SetText($hStatusBar, "Right Margin: " & $aMargins[1], 1)

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