Function Reference


_GUICtrlEdit_GetRECTEx

Retrieves the formatting rectangle of an edit control

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

Parameters

$hWnd Control ID/Handle to the control

Return Value

Returns a $tagRECT structure that recieves formatting rectangle of an edit control.

Remarks

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

Related

$tagRECT, _GUICtrlEdit_GetRECT

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 RECTEx (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 RectEx
        Local $tRECT = _GUICtrlEdit_GetRECTEx($idEdit)
        DllStructSetData($tRECT, "Left", DllStructGetData($tRECT, "Left") + 10)
        DllStructSetData($tRECT, "Top", DllStructGetData($tRECT, "Top") + 10)
        DllStructSetData($tRECT, "Right", DllStructGetData($tRECT, "Right") - 10)
        DllStructSetData($tRECT, "Bottom", DllStructGetData($tRECT, "Bottom") - 10)

        ; Set RectEx
        _GUICtrlEdit_SetRECTEx($idEdit, $tRECT)

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

        ; Get RectEx
        $tRECT = _GUICtrlEdit_GetRECTEx($idEdit)
        _GUICtrlStatusBar_SetText($hStatusBar, "Left: " & DllStructGetData($tRECT, "Left"), 1)
        _GUICtrlStatusBar_SetText($hStatusBar, "Topt: " & DllStructGetData($tRECT, "Top"), 2)
        _GUICtrlStatusBar_SetText($hStatusBar, "Right: " & DllStructGetData($tRECT, "Right"), 3)
        _GUICtrlStatusBar_SetText($hStatusBar, "Bottom: " & DllStructGetData($tRECT, "Bottom"), 4)

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