Wb-FreeKill Posted March 6, 2005 Share Posted March 6, 2005 (edited) I would like to make a file search (i got that) but when it find the files, it should list it in this listview, thats easy, but for each file, i would have to make a ListViewItem right? could it create them after how many files was found? #include <GUIConstants.au3> GUICreate("listview items",400,300, 100,200,-1,$WS_EX_ACCEPTFILES) GUISetBkColor (0x00E0FFFF); will change background color $listview = GUICtrlCreateListView ("Filename |Filetype|Size |Location ",10,10,380,150);,$LVS_SORTDESCENDING) $button = GUICtrlCreateButton ("Value?",75,170,70,20) $item1=GUICtrlCreateListViewItem("item2|col22|col23",$listview) $item2=GUICtrlCreateListViewItem("item1|col12|col13",$listview) $item3=GUICtrlCreateListViewItem("item3|col32|col33",$listview) ;$input1=GUICtrlCreateInput("",20,200, 150) GUICtrlSetState(-1,$GUI_ACCEPTFILES) ; to allow drag and dropping GUISetState() GUICtrlSetData($item1,"Groove Coverage|mp3|3434 Kb| C:\Musik",) GUICtrlSetData($item2,"Groove Coverage|mp3|3434 Kb| C:\Musik",) GUICtrlSetData($item3,"Groove Coverage|mp3|3434 Kb| C:\Musik",) Do $msg = GUIGetMsg () Select Case $msg = $button MsgBox(0,"listview item",GUICtrlRead(GUICtrlRead($listview))) Case $msg = $listview MsgBox(0,"listview", "clicked="& GUICtrlGetState($listview)) EndSelect Until $msg = $GUI_EVENT_CLOSE Edited March 6, 2005 by Wb-FreeKill Link to comment Share on other sites More sharing options...
therks Posted March 6, 2005 Share Posted March 6, 2005 (edited) Yeah it wouldn't be hard. Although I must say that I've experienced a limit to how many ListView items can be created. The function doesn't fail or anything, but they just stop appearing. Anyway, what you'd need to do is while you're searching the files, put each file into an array value, then have a loop go through that array, and create listitems. Or you could do something like this: $h_FileSearch = FileFindFirstFile('C:\*.*') $i_FileCount = 0 While 1 $s_File = FileFindNextFile($h_FileSearch) If @error Then ExitLoop Assign('s_FileList' & $i_FileCount, $s_File) $i_FileCount = $i_FileCount + 1 WEnd Dim $a_ListItems[$i_FileCount] For $i = 0 to $i_FileCount - 1 $a_ListItems[$i] = GUICtrlCreateListViewItem(Eval('s_FileList' & $i), $listview) Next This way you can reference all the listview items to the array items. Edited March 6, 2005 by Saunders My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now