Function Reference


_GUICtrlTreeView_GetVisibleCount

Returns the number of items that can be fully visible in the control

#include <GuiTreeView.au3>
_GUICtrlTreeView_GetVisibleCount ( $hWnd )

Parameters

$hWnd Control ID/Handle to the control

Return Value

Returns the Maximum number of items possibly visible in the control.

Remarks

The number of items that can be fully visible may be greater than the number of items in the control.
The control calculates this value by dividing the height of the client window by the height of an item.
Note that the return value is the number of items that can be fully visible.
If you can see all of 20 items and part of one more item, the return value is 20 not 21.

Example

#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
        GUICreate("TreeView Get Visible Count (v" & @AutoItVersion & ")", 400, 300)

        Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS)
        Local $idTreeView = GUICtrlCreateTreeView(2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
        GUISetState(@SW_SHOW)

        _GUICtrlTreeView_BeginUpdate($idTreeView)
        For $x = 0 To 99
                _GUICtrlTreeView_Add($idTreeView, 0, StringFormat("[%02d] New Item", $x))
        Next
        _GUICtrlTreeView_EndUpdate($idTreeView)

        MsgBox($MB_SYSTEMMODAL, "Information", "Visible: " & _GUICtrlTreeView_GetVisibleCount($idTreeView))

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