Jump to content

Array -> ListView Problem


Recommended Posts

Okay, so I know that this is a simple fix, I just cant for the life of me figure it out. Someone point me in the right direction...

Func _ListFiles($sPath)
        Local $aFileList, $i = 1
        $aFileList = _FileListToArray($sPath, "*", 1)
        If @error = 1 Then
            MsgBox(48, $sTitle, "No files were found in the directory specified." & @CRLF & @CRLF & $sPath)
            Exit
        Endif

        For $i = 1 To $aFileList[0]
            $lvFilesItem = GUICtrlCreateListViewItem($i & "|" & $sPath & "|" & StringStripCR($aFileList[$i]), $lvFiles)
    
;       If $lvEven Then
;           $lvEven = 0
;       Else
;           $lvEven = 1
;           GUICtrlSetBkColor($lvItem, $GUIBkColor)
;       EndIf
        Next
    ; _ArrayDisplay($aFileList, "$FileList")
    EndFunc; ==> _ListFiles

The above function is supposed to populate a list view with the information returned by _FileListToArray. It does that, but it wont stop. It continually cycles through, re-adding the same array to the list view. What did I do wrong? I cant see the error in the logic, and everything I've tried left me with the same situation. Any help is greatly appreciated.

Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki
Link to comment
Share on other sites

You are probably calling Func _ListFiles() in some cycle and there is error in your logic (outside this function)

The problem is inside this function, not outside. :)

Current Projects:Remote Administration Suite Updated! 12-20-07Remote User State Migration Tool (Plugin) Updated! 12-20-07Batch Print Wizard Updated! 12-20-07Links:AutoIt Beta | AutoIt Wiki
Link to comment
Share on other sites

The best way to see what your script is doing is to trace its execution - you can use the option "Add Trace Lines" from SciTE/Tools menu and see what your script is doing.

There is no obvious reason inside this function to make it to repeat the for-next cycle over and over so, as Zedna said, the error should be outside (a While or a Do statement maybe or a "bad placed" Return)

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...