Sign in to follow this  
Followers 0
darzanmihai

Update listview issue

5 posts in this topic

Hi

I havea listview holding about 100 items, that needs to be updated at user demand. the problem is that when I update the listview, it flickers and this is very annoying.

How could I update the listview without makeing it flicker?

This is the function I use to update the listview:

Func Refresh_Cons_List($ListView)
    _GUICtrlListView_BeginUpdate($ListView)
    _GUICtrlListView_DeleteAllItems($ListView)
    Local $aResult = "", $iRows = "", $iColumns = ""
    Local $aResult_1 = "", $iRows_1 = "", $iColumns_1 = ""
    _SQLite_GetTable2d($db, "select * from consumatori", $aResult, $iRows, $iColumns)
    $vizati_state = GUICtrlRead($Checkbox_vizati)
    If UBound($aResult) > 1 Then
        For $i = 1 To UBound($aResult) - 1
            ;ID|Consumator|Distribuitor|Inc.Con.Distrib.|Fin.Con.Distrib.|Inc.Con.Furniz.|Fin.Con.Furniz.
            _SQLite_GetTable2d($db, "select * from fosticonsumatori where id_c='" & $aResult[$i][0] & "';", $aResult_1, $iRows_1, $iColumns_1)
            If UBound($aResult_1)<=1 Then
                $fin_distrib = $aResult[$i][4]
                $fin_furnizare = $aResult[$i][6]
                $now = @YEAR & "/" & @MON & "/" & @MDAY
                $d_dif_distrib = _DateDiff("d", $now, $fin_distrib);yyyy/mm/dd
                $d_dif_furniz = _DateDiff("d", $now, $fin_furnizare)

                If $vizati_state = $GUI_CHECKED Then
                    If $d_dif_distrib <= $day_diff Or $d_dif_furniz <= $day_diff Then
                        GUICtrlCreateListViewItem($aResult[$i][0] & "|" & $aResult[$i][1] & "|" & $aResult[$i][2] & "|" & $aResult[$i][3] & _
                                            "|" & $aResult[$i][4] & "|" & $aResult[$i][5] & "|" & $aResult[$i][6], $ListView)
                        GUICtrlSetBkColor(-1, 0xb9b6b3)
                        GUICtrlSetColor(-1, 0xff0000)
                    EndIf
                Else
                    GUICtrlCreateListViewItem($aResult[$i][0] & "|" & $aResult[$i][1] & "|" & $aResult[$i][2] & "|" & $aResult[$i][3] & _
                                        "|" & $aResult[$i][4] & "|" & $aResult[$i][5] & "|" & $aResult[$i][6], $ListView)
                    GUICtrlSetBkColor(-1, 0xb9b6b3)
                    If $d_dif_distrib <= $day_diff Or $d_dif_furniz <= $day_diff Then GUICtrlSetColor(-1, 0xff0000)
                EndIf
            EndIf
            $aResult_1 = ""
            $iRows_1 = ""
            $iColumns_1 = ""
        Next
    EndIf
    _GUICtrlListView_SortItems($ListView, 1)
    _GUICtrlListView_SortItems($ListView, 1)
    _GUICtrlListView_EndUpdate($ListView)
    $aResult = ""
    $iRows = ""
    $iColumns = ""
EndFunc ;==>Refresh_Cons_List

I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Share this post


Link to post
Share on other sites

Thx for reply

The second link is usefull but is very complicated to have 2 listviews for each listview I have....and I have many listviews in my script...

Isn't there any other way?

Thx again


I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Share this post


Link to post
Share on other sites

Someone?


I do not like stupid and idiot people that write idiot things...If you are one, do not write.

Share this post


Link to post
Share on other sites

Is there someone who can help me?


I do not like stupid and idiot people that write idiot things...If you are one, do not write.

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