UDF > GUI > GuiEdit >


_GUICtrlEdit_CharFromPos

Obtient des informations sur le caractère le plus proche d'un point donné dans la zone client

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

Paramètres

$hWnd ID/handle du contrôle
$iX Position horizontale du point
$iY Position verticale du point

Valeur de retour

Retourne un tableau dans le format suivant:
    [0] - Index, à partir de 0, du caractère le plus proche du point spécifié
    [1] - Index, à partir de 0, de la ligne qui contient le caractère

Exemple

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

Example()

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

    ; Crée une 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]))

    ; Boucle jusqu'à ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example