Function Reference


_GUICtrlEdit_CharFromPos

Retrieve information about the character closest to a specified point in the client area

#include <GuiEdit.au3>
_GUICtrlEdit_CharFromPos ( $hWnd, $iX, $iY )

Parameters

$hWnd Control ID/Handle to the control
$iX horizontal position
$iY vertical position

Return Value

Returns an array in the following format:
    [0] - 0-based index of the character nearest the specified point
    [1] - 0-based index of the line that contains the character

Example

#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
        Local $aCharPos[2], $idEdit

        ; Create GUI
        GUICreate("Edit Char From Pos", 400, 300)
        $idEdit = GUICtrlCreateEdit("This is a test" & @CRLF & "Another Line", 2, 2, 394, 268)
        GUISetState(@SW_SHOW)

        _GUICtrlEdit_AppendText($idEdit, @CRLF & "Append to the end?")

        $aCharPos = _GUICtrlEdit_CharFromPos($idEdit, 100, 20)
        MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("Char Nearsest Point: [%2d]", $aCharPos[0]) & @CRLF & _
                        StringFormat("Line Nearest Point: [%2d]", $aCharPos[1]))

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