Function Reference


_GUICtrlListView_GetSubItemRect

Retrieves information about an item bounding rectangle

#include <GuiListView.au3>
_GUICtrlListView_GetSubItemRect ( $hWnd, $iIndex, $iSubItem [, $iPart = 0] )

Parameters

$hWnd Control ID/Handle to the control
$iIndex 0-based index of the subitem's parent item
$iSubItem 1-based index of the subitem
$iPart [optional] The portion of the subitem item to retrieve:
    0 - The rectangle of the entire subitem, including the icon and label
    1 - The rectangle of the icon or small icon

Return Value


Returns an array with 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

This function is used only with controls that use the $LVS_REPORT style.

Example

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

Example()

Func Example()
        GUICreate("ListView Get SubItem Rect (v" & @AutoItVersion & ")", 400, 300)
        Local $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
        GUISetState(@SW_SHOW)

        ; Set ANSI format
;~     _GUICtrlListView_SetUnicodeFormat($idListview, False)

        ; Add columns
        _GUICtrlListView_AddColumn($idListview, "Column 1", 100)
        _GUICtrlListView_AddColumn($idListview, "Column 2", 100)
        _GUICtrlListView_AddColumn($idListview, "Column 3", 100)

        ; Add items
        _GUICtrlListView_AddItem($idListview, "Row 1: Col 1")
        _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 2", 1)
        _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 3", 2)
        _GUICtrlListView_AddItem($idListview, "Row 2: Col 1")
        _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 2", 1)
        _GUICtrlListView_AddItem($idListview, "Row 3: Col 1")

        ; Show item 2 sub item rect
        Local $aRect = _GUICtrlListView_GetSubItemRect($idListview, 1, 1)
        MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("Subitem Rectangle : [%d, %d, %d, %d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3]))

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