Function Reference


_GUICtrlEdit_GetRECT

Retrieves the formatting rectangle of an edit control

#include <GuiEdit.au3>
_GUICtrlEdit_GetRECT ( $hWnd )

Parameters

$hWnd Control ID/Handle to the control

Return Value

Returns an array containing the RECT in the following format:
    [0] - X coordinate of the upper left corner of the rectangle
    [1] - Y coordinate of the upper left corner of the rectangle
    [2] - X coordinate of the lower right corner of the rectangle
    [3] - Y coordinate of the lower right corner of the rectangle

Remarks

Under certain conditions, _GUICtrlEdit_GetRECT() might not return the exact values that
_GUICtrlEdit_SetRECT() set—it will be approximately correct, but it can be off by a few pixels.

Related

_GUICtrlEdit_GetRECTEx

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"

        ; Create GUI
        Local $hGUI = GUICreate("Edit Get/Set RECT (v" & @AutoItVersion & ")", 400, 300)
        Local $idEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
        Local $aPartRightSide[6] = [50, 75, 75, 75, 75, -1]
        Local $hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
        _GUICtrlStatusBar_SetIcon($hStatusBar, 5, 97, "shell32.dll")
        _GUICtrlStatusBar_SetText($hStatusBar, "Rect")
        GUISetState(@SW_SHOW)

        ; Get Rect
        Local $aRect = _GUICtrlEdit_GetRECT($idEdit)
        $aRect[0] += 10
        $aRect[1] += 10
        $aRect[2] -= 10
        $aRect[3] -= 10

        ; Set Rect
        _GUICtrlEdit_SetRECT($idEdit, $aRect)

        ; Add Text
        _GUICtrlEdit_AppendText($idEdit, FileRead($sFile))
        _GUICtrlEdit_LineScroll($idEdit, 0, _GUICtrlEdit_GetLineCount($idEdit) * -1)

        ; Get Rect
        $aRect = _GUICtrlEdit_GetRECT($idEdit)
        _GUICtrlStatusBar_SetText($hStatusBar, "Left: " & $aRect[0], 1)
        _GUICtrlStatusBar_SetText($hStatusBar, "Top: " & $aRect[1], 2)
        _GUICtrlStatusBar_SetText($hStatusBar, "Right: " & $aRect[2], 3)
        _GUICtrlStatusBar_SetText($hStatusBar, "Bottom: " & $aRect[3], 4)

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