Modify

Opened 12 years ago

Closed 12 years ago

#32 closed Bug (Fixed)

_GUICtrlTreeView_GetNext does not return 0 for last item

Reported by: DarkTurok Owned by: Gary
Milestone: 3.2.11.0 Component: Standard UDFs
Version: 3.2.10.0 Severity:
Keywords: XP SP2 Cc:

Description

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

Attachments (0)

Change History (1)

comment:1 Changed 12 years ago by Gary

  • Milestone set to 3.2.11.0
  • Resolution set to fixed
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Gary.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.