Sign in to follow this  
Followers 0
Ghastly_MIB

ListView Limit

4 posts in this topic

#1 ·  Posted (edited)

Hey,

I'm creating a fast seach engine, bet there's one problem.

The search results are added to a ListView item.

But after searching a shore time with a lot of files, it won't add anymore.

And when i'm sorting the listbox with icon, it won't add some files.

First sorting is working well, but after the seccond one it will delete 40% of the list items B).

This is the function i'm using:

Func _GUICtrlListViewSortWI(ByRef $h_listview, ByRef $v_descending, $i_sortcol, $s_Title = "", $s_text = "")
    Local $X, $Y, $b_desc, $columns, $items, $v_item, $temp_item, $i_icon, $item_list, $text
    _SetProgress(0, "Sorteren")
    If (StringLen($s_Title) == 0) Then
        $s_Title = WinGetTitle("")
    EndIf
    If (IsArray($v_descending)) Then
        $b_desc = $v_descending[$i_sortcol]
    Else
        $b_desc = $v_descending
    EndIf
    $columns = _GUICtrlListViewGetSubItemsCount($h_listview, $s_Title, $s_text)
    $items = _GUICtrlListViewGetItemCount($h_listview)
    If $items = 0 Then Return
    Local $a_lv[$items][$columns]
    For $X = 0 To UBound($a_lv) - 1 Step 1
        For $Y = 0 To UBound($a_lv, 2) - 1 Step 1
            $v_item = _GUICtrlListViewGetItemText ($h_listview, $X, $Y, $s_Title, $s_text)
            If (StringIsFloat($v_item) Or StringIsInt($v_item)) Then
                $a_lv[$X][$Y] = Number($v_item)
            Else
                $a_lv[$X][$Y] = $v_item
            EndIf
        Next
    Next
    _GUICtrlListViewDeleteAllItems($h_listview)
    _ArraySort($a_lv, $b_desc, 0, 0, $columns, $i_sortcol)
    For $X = 0 To UBound($a_lv) - 1 Step 1
        $text = ""
        For $Y = 0 To UBound($a_lv, 2) - 1 Step 1
            $text = $text & $a_lv[$X][$Y] & "|"
        Next
        $item_list = GUICtrlCreateListViewItem($text, $h_listview)
        If $item_list=0 Then MsgBox(0, "", "Niet aanmaken")
        $i_size = _Size($a_lv[$X][2] & $a_lv[$X][0])
        menu_generate($item_list, $i_size)
        If $i_size <> -1 Then
            $i_icon = _Icon($a_lv[$X][2] & $a_lv[$X][0])
            GUICtrlSetImage($item_list, $i_icon[0], $i_icon[1])
        Else
            GUICtrlSetImage($item_list, "shell32.dll", 131)
        EndIf
        _SetProgress(UBound($a_lv), $X)
    Next
    _SetProgress(0, "Gereed")
    If (IsArray($v_descending)) Then
        For $n = 0 To UBound($v_descending)-1
            If $n <> $i_sortcol Then $v_descending[$n] = False
        Next
        $v_descending[$i_sortcol] = Not $b_desc
    Else
        $v_descending = Not $b_desc
    EndIf
EndFunc;==>_GUICtrlListViewSortWI

Thanks, Ghastly_MIB

Edited by Ghastly_MIB

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

As every Listview-item counts as one control you reach the maximum allowed

number of controls for a window. I know...it sucks.

Helpfile : "Maximum number of GUI controls per window: 4096"

Edited by Helge

Share this post


Link to post
Share on other sites

Is there a way to fix that?!? :oB)

Share this post


Link to post
Share on other sites

I found a way to add more using _GUICtrlListViewInsertItem(...)

but now I cant add a menu to a file, and no icon:(

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  
Followers 0