Jump to content
Sign in to follow this  
RagnaroktA

Array -> ListView Problem

Recommended Posts

RagnaroktA

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

Share this post


Link to post
Share on other sites
enaiman

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 :)

Share this post


Link to post
Share on other sites
GaryFrost

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

I would have to agree with Zedna on this, I see no problem with the function itself.


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
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
Sign in to follow this  

×