spiderblues Posted April 17, 2005 Posted April 17, 2005 (edited) Hi there, I try to delete a listview, to load new data, but it doesn't work correct. The new listview isn't clickable, the first col isn't shown, and I'm not able to scroll the listview... What am I doing wrong? Here are some parts of the code: selecting the file, and read header for listview: $filename = FileOpenDialog("CSV-Datei öffnen", -1, "CSV-Dateien (*.csv)", 1 + 4 ) $heading = _ReadHeader() _LoadListview() expandcollapse popup;################################################################################################# ;# ;# Func _LoadListview() ;# ;# Shows selected columns from a .csv File ($viewed_cols[]) in a ListView Control ;# ;# Global vars: ;# $heading,$Xstart,$Ystart,$lv_width,$lv_height, $all_items, $viewed_cols, $listview, $filename ;# ;################################################################################################# Func _LoadListview() _ClearListview() $all_items = _ArrayClear($all_items) $listview = GUICtrlCreateListView ($heading,$Xstart,$Ystart,$lv_width,$lv_height) GUICtrlSetResizing (-1,$GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $file = FileOpen($filename, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Fehler", "Datei " & $filename & " kann nicht gelesen werden...") Exit EndIf $line = FileReadLine($file);first line is headline ; Read in lines of text until the EOF is reached $i = 0 While 1 $nr = $i + 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop $fields = StringSplit ( $line, $delimiter) $list_item = $nr For $j = 0 To UBound($viewed_cols)-1 $list_item = $list_item & "|" & $fields[$viewed_cols[$j]] Next $all_items[$i] = GUICtrlCreateListViewItem($list_item,$listview) $i = $i + 1 Wend FileClose($file) Global $b_Descending[_GUICtrlGetListViewColsCount($listview)] EndFunc ;################################################################################################# ;# ;# Func _ClearListview() ;# ;# deletes global ListView $listview ;# ;# Global vars: ;# $pgm_name, $listview ;# ;################################################################################################# Func _ClearListview() $ItemCount = ControlListView($pgm_name,"",$listview, "GetItemCount") For $i = 0 To $ItemCount -1 GuiCtrlSendMsg($listview, $LVM_DELETEITEM, $i, 0) Next EndFunc Is this bad what I'm doing???? Please help me... spider Edited April 17, 2005 by spiderblues
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