﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
32	_GUICtrlTreeView_GetNext does not return 0 for last item	DarkTurok	Gary	"The following code shows a bug in _GUICtrlTreeView_GetNext.

The bug also affects _GUICtrlTreeView_FindItem; this routine will enter a infinite loop when the searched text is not found in the tree-view, because it relies on _GUICtrlTreeView_GetNext to return zero when called for the last item. (Thus prio Major)

{{{
#include <GuiConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiImageList.au3>

Opt('MustDeclareVars', 1)

Example_External()

Func Example_External()

    Local $GUI, $hItem[10], $hTreeView
    Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS )

    $GUI = GUICreate(""(External) TreeView Get Next"", 400, 300)

    $hTreeView = _GUICtrlTreeView_Create ($GUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE)
    GUISetState()

    _GUICtrlTreeView_BeginUpdate ($hTreeView)
    For $x = 0 To 5
        $hItem[$x] = _GUICtrlTreeView_Add ($hTreeView, 0, StringFormat(""[%02d] New Item"", $x + 1), $iImage, $iImage)
    Next
    _GUICtrlTreeView_EndUpdate ($hTreeView)

	If _GUICtrlTreeView_GetNext( $hTreeView, $hItem[5] ) <> 0 Then
    	MsgBox(4160, ""Information"", ""_GUICtrlTreeView_GetNext does not return 0 when called with last item"" )
    EndIf

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example_External
}}}"	Bug	closed	3.2.11.0	Standard UDFs	3.2.10.0		Fixed	XP SP2	
