Jump to content

Virtual listviews for huge number of rows


LarsJ
 Share

Recommended Posts

The usual way is to extract data directly from the source. But in your code, I think you can extract data from the data cache, the $aResult array.

You can also extract data in the columns to be colored from the database and save data in its own array. You can do that in the start of your program. If you have many rows in your database, it'll be a large array.

Maybe take a look at the techniques used in this example.

Link to comment
Share on other sites

  • 1 month later...

It's not possible to display a treeview in a column of a listview.

This process explorer control seems to be a combination of a treeview and a listview but separated as two controls. The scrollbars are removed in the treeview. The horizontal scrollbar belongs to the listview. The rows in the treeview and listview are synchronized. The listview is probably a virtual listview (easy to update dynamically).

I'll not deny that it's possible to create a similar control in AutoIt, but it'll not be quite easy.

Link to comment
Share on other sites

Take a look at LvVirtArrayIcons.au3 in zip-file in first post. Modify the example to handle subitem icons.

Link to comment
Share on other sites

I found a solution
Thanks for help

But I encountered two problems again

1. first column (0 column) has a blank icon
I hope there is no blank icon

 

5ab3e1447d15e_.jpg.e7de6d563bf7bb718d14933620668349.jpg

 

 

 

2._GUICtrlListView_SetImageList

--------------------------------------------------------
[optional] Type of image list:
  0 - Image list with large icons
  1 - Image list with small icons
  2 - Image list with state images
-------------------------------------------------------

I already know how to use Type 1 and Type 2

Is there a way to use Type 0?

Because I want to create two ImageLists using Type 0 and Type 1

And then select an icon using TYPE1 or TYPE0 in LISTVIEW

Is there a way to achieve it?

558.jpg.6c783b1985f18de81105e66526bcef21.jpg

Edited by kklee69
Link to comment
Share on other sites

  • 2 weeks later...

Like I said, your Virtual listviews  helped me a lot
thank you very much

I usually use [Data stored in arrays ]  Add  MSSQL SERVER

I USE  [   $conn.Execute ("SELECT  * FROM  DB1   ").GetRows  ] TO PUT data INTO Arrays

However, when the data is large , It is still very slow

So I want to read data in batches

Then I saw [Data stored in databases] ,It's what I want

But your example is for SQLlite

I spent a lot of time and I can't convert it to MSSQL

Can you give me an example for MSSQL ?

Link to comment
Share on other sites

Link to comment
Share on other sites

This is definitely because there is an error in the code in $LVN_ODCACHEHINT or $LVN_GETDISPINFO sections or in the row-relation table. Add some ConsoleWrite's to see what's going on.

To make debugging easier you should adjust the height of the listview to match an integral number of rows eg. 10 or 15 (no half rows) and you should limit the number of rows extracted from the database to 100.

Link to comment
Share on other sites

I already know why

Thank you for your remind

First need to GET  $iFrom  0 TO 15 ,That means 16 item

But my data starts at 1 ,So the data is only 15 item


$tagNMLVCACHEHINT = $tagNMHDR & ";int iFrom;int iTo"

SO   $LVN_ODCACHEHINT  Only use int ??

Can I use text(char) as a Serial number ?  like NAME ??

for example SQL " SELECT * FROM people Where Name > 'A' AND Name < 'C' "

Or use  data of  Subitem 0   as  a  Serial number ??

Or can I increase the number of buffered ITEMs?

Maybe read 100 ITEMs at once

This will reduce the number of communications with the SERVER

 

Edited by kklee69
Link to comment
Share on other sites

Link to comment
Share on other sites

  • 1 year later...

can i have small example on search function for $LVN_ODFINDITEM notifications in database-powered ListView:

"SELECT DisplayView.Hash,Title,Date,Subject FROM DisplayView INNER JOIN DisplayMemDb.RowRelation ON DisplayView.Hash = DisplayMemDb.RowRelation.Hash WHERE DisplayMemDb.RowRelation.rowid BETWEEN " & $sFrom & " And " & $sTo & ";"

Search function should return listview item id, but how i can retrieve rowid from DisplayMemDb.RowRelation table - all i get is :

err msg   : 'no such table: DisplayMemDb.RowRelation'
err str   : 'SQL logic error'

in responce to query : "SELECT rowid FROM DisplayMemDb.RowRelation WHERE ...

Link to comment
Share on other sites

Note that LVN_ODFINDITEM is usually only used to find a specific row when the rows are already sorted alphabetically. If you press m on the keyboard then the first row containing m in the first character will become the first visible row in the listview. Your function should simply return the listview index of this row.

If you want to see an example, then create a simple example and then I'll add the LVN_ODFINDITEM function.

Link to comment
Share on other sites

 

#include <GuiListView.au3>
#include <FontConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTreeView.au3>
#include <SQLite.au3>
#include <Math.au3>
#include <GDIPlus.au3>

$hDLL_Crypt32 = DllOpen("Crypt32.dll")
$hDLL_ntdll = DllOpen("ntdll.dll")
$hDLL_gdi32 = DllOpen("gdi32.dll")


Global Const $sSqlBuild_Table   = "(GroupTitle TEXT COLLATE NOCASE, Hash TEXT PRIMARY KEY NOT NULL, Title TEXT COLLATE NOCASE, Date TEXT, Subject TEXT COLLATE NOCASE, UnixTimeStamp INTEGER, IsRead INTEGER DEFAULT 0)"
Global Const $sSqlFill_Table    = "(GroupTitle, Hash, Title, Date, Subject, UnixTimeStamp)"

Global Const $iRowsMAX = 10000

Global Const $tagNMLVCACHEHINT = $tagNMHDR & ";int iFrom;int iTo"
Global $aListView, $hListView, $TreeView_SelTitle, $aTreeViewState[19][8] = [[18,"","","","","","",""]], $sSelectedTVIndex = 3
Global $hListView_ImageList, $hTreeViewFont, $hTreeViewFontBold, $hListViewFont, $hListViewFontBold

For $i = 1 To $aTreeViewState[0][0]
    $aTreeViewState[$i][0] = 3 ; icon num in "shell32.dll"
    $aTreeViewState[$i][1] = 0x000000 ; item text color
    $aTreeViewState[$i][2] = 0 ; text is bold (or not)
    $aTreeViewState[$i][3] = 0 ; some additional text
    $aTreeViewState[$i][5] = "Group Title " & $i; name
Next

if FileExists("Test.sqlite") Then FileDelete("Test.sqlite")

CreateDB($iRowsMAX)

_SQLite_Startup()
_SQLite_Open( "Test.sqlite" )
_SQLite_SetTimeout(-1, 888888)

_SQLite_Exec(-1, "ATTACH DATABASE ':memory:' AS DisplayMemDb;" )

_GDIPlus_Startup()

Opt("GUIOnEventMode", 1)

#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Form1", 881, 516, -1, -1)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
Global $hTreeView = _GUICtrlTreeView_Create($Form1, 8, 16, 319, 489, BitOR($GUI_SS_DEFAULT_TREEVIEW,$WS_HSCROLL,$WS_VSCROLL, $TVS_SHOWSELALWAYS,$WS_HSCROLL,$WS_BORDER, $TVS_INFOTIP), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$TreeView_Root_1 = _GUICtrlTreeView_Add($hTreeView, 0, "Root - 1")
_GUICtrlTreeView_SetIcon($hTreeView, $TreeView_Root_1, "shell32.dll", 4)
$TreeView_Root_2 = _GUICtrlTreeView_Add($hTreeView, 0, "Root - 2")
_GUICtrlTreeView_SetIcon($hTreeView, $TreeView_Root_2, "shell32.dll", 4)

ControlCreateFonts($hTreeView, $hTreeViewFont, $hTreeViewFontBold)

Global $idListView = GUICtrlCreateListView("hash|Title|Time|Subject", 336, 16, 538, 486,  BitOR($LVS_OWNERDATA,$LVS_SHOWSELALWAYS));,$LVS_SINGLESEL
_GUICtrlListView_SetExtendedListViewStyle( $idListView, BitOR($LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES, $WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))

GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 0)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 310)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 88)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 112)
GUICtrlSetOnEvent(-1, "ListViewClick")

SetIconListToListView()

$hListView = GUICtrlGetHandle($idListView)

ControlCreateFonts($hListView, $hListViewFont, $hListViewFontBold)

Local $idTVContextMenu = GUICtrlCreateContextMenu(GUICtrlCreateDummy())
$hTVContextMenu = GUICtrlGetHandle($idTVContextMenu)
Local $idTVContextMenu_Refresh = GUICtrlCreateMenuItem("Refresh", $idTVContextMenu)
Local $idTVContextMenu_Rename = GUICtrlCreateMenuItem("Rename", $idTVContextMenu)
GUICtrlCreateMenuItem("", $idTVContextMenu) ; separator
Local $idTVContextMenu_MarkALLRead = GUICtrlCreateMenuItem("Mark ALL Items Read", $idTVContextMenu)
Local $idTVContextMenu_MarkALLUnRead = GUICtrlCreateMenuItem("Mark ALL Items UnRead", $idTVContextMenu)

GUIRegisterMsg($WM_NOTIFY, "LWS_WM_NOTIFY")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

SubFunction_FillTreeView()

While 1
    Sleep(100)
WEnd

Func Form1Close()
    GUIRegisterMsg( $WM_NOTIFY, "" )
    ;
    DllClose($hDLL_Crypt32)
    DllClose($hDLL_ntdll)
    _GDIPlus_Shutdown()

    _SQLite_Close()
    _SQLite_Shutdown()
    Exit
EndFunc
;==========================================================================================
Func ListViewClick()

EndFunc
;==========================================================================================
Func SubFunction_FillTreeView()

    Local $idTVItem[$aTreeViewState[0][0]+1] = [$aTreeViewState[0][0]]

    _GUICtrlTreeView_BeginUpdate($hTreeView)
    _GUICtrlTreeView_DeleteChildren($hTreeView, $TreeView_Root_1)
    _GUICtrlTreeView_DeleteChildren($hTreeView, $TreeView_Root_2)
    _GUICtrlTreeView_SetTextColor($hTreeView, 0x77B5FE) ; color of additional text

   For $i = 1 To $aTreeViewState[0][0]

        Switch Mod($i,2)
            Case 0
                $idTVItem[$i] = _GUICtrlTreeView_AddChild($hTreeView,$TreeView_Root_2, $aTreeViewState[$i][5])
            Case Else
                $idTVItem[$i] = _GUICtrlTreeView_AddChild($hTreeView,$TreeView_Root_1, $aTreeViewState[$i][5])
        EndSwitch
        Switch Mod($i,3)
            Case 0
                $aTreeViewState[$i][2] = 0
            Case Else
                $aTreeViewState[$i][2] = 1
        EndSwitch
        _GUICtrlTreeView_SetItemParam($hTreeView, $idTVItem[$i], $i)
        _GUICtrlTreeView_SetIcon($hTreeView, $idTVItem[$i], "shell32.dll", $aTreeViewState[$i][0])
    Next
    _GUICtrlTreeView_Expand($hTreeView, $TreeView_Root_1, True)
    _GUICtrlTreeView_EndUpdate($hTreeView)

    _GUICtrlTreeView_ClickItem($hTreeView, $idTVItem[$sSelectedTVIndex])

    SubFunction_FillListView()

EndFunc
;==========================================================================================
Func SubFunction_FillListView_Delayed()
    AdlibUnRegister("SubFunction_FillListView_Delayed")
    SubFunction_FillListView()
EndFunc
;==========================================================================================
Func SubFunction_FillListView()

    Local $iTVSelIndex = _GUICtrlTreeView_GetItemParam($hTreeView, _GUICtrlTreeView_GetSelection($hTreeView))

    _SQLite_Exec( -1, "DROP VIEW IF EXISTS DisplayView;" )
    _SQLite_Exec( -1, "DROP TABLE IF EXISTS DisplayMemDb.RowRelation;" )

    _SQLite_Exec( -1, "CREATE TEMP VIEW DisplayView AS SELECT Hash,Title,Date,Subject,IsRead,GroupTitle FROM lvdata WHERE GroupTitle IS '" & $aTreeViewState[$iTVSelIndex][5] & "' ORDER BY UnixTimeStamp DESC;" )
    _SQLite_Exec( -1, "CREATE TABLE DisplayMemDb.RowRelation AS SELECT Hash FROM DisplayView;" )


    GUICtrlSendMsg($idListView, $LVM_SETITEMCOUNT, $aTreeViewState[$iTVSelIndex][3] , 0)

EndFunc
;==========================================================================================
Func LWS_WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam )
    Local Static $tText = DllStructCreate( "wchar[512]" )
    Local Static $pText = DllStructGetPtr( $tText )
    Local Static $aResult, $iRows, $iFrom, $tRectLVI = DllStructCreate( $tagRECT ), $pRectLVI = DllStructGetPtr( $tRectLVI )

    Local $tNMHDR, $hWndFrom, $iCode, $tInfo, $VKey
    $tNMHDR = DllStructCreate( $tagNMHDR, $lParam )
    $hWndFrom = HWnd( DllStructGetData( $tNMHDR, "hWndFrom" ) )
    $iCode = DllStructGetData( $tNMHDR, "Code" )

    Switch $hWndFrom
        Case $hTreeView
            Switch $iCode

                Case $NM_CUSTOMDRAW
                    Local $tNMTVCUSTOMDRAW = DllStructCreate($tagNMTVCUSTOMDRAW, $lParam)
                    Local $dwDrawStage = DllStructGetData($tNMTVCUSTOMDRAW, "DrawStage")

                    Switch $dwDrawStage                                             ; Holds a value that specifies the drawing stage

                        Case $CDDS_PREPAINT
                            ; Before the paint cycle begins
                            Return $CDRF_NOTIFYITEMDRAW ; Notify the parent window of any item-related drawing operations

                        Case $CDDS_ITEMPREPAINT
                            ; Before painting an item
                            Local $hItemSpec  = DllStructGetData($tNMTVCUSTOMDRAW, "ItemSpec")          ; $hItemSpec = $hItem
                            Local $iItemState = DllStructGetData($tNMTVCUSTOMDRAW, "ItemState")
                            Local $iItemParam = DllStructGetData($tNMTVCUSTOMDRAW, "ItemParam")         ; ItemParam = index in array
                            Local $hDC        = DllStructGetData($tNMTVCUSTOMDRAW, "HDC")               ; Handle to the item's device context

                            $iSelected = DllCall( "user32.dll", "lresult", "SendMessageW", "hwnd", $hTreeView, "uint", $TVM_GETITEMSTATE, "wparam", $hItemSpec, "lparam", $TVIS_SELECTED )[0] ; Selected state
                            If BitAND( $iSelected, $TVIS_SELECTED ) Then Return $CDRF_NOTIFYPOSTPAINT

                            ;If Not BitAnd( $iItemState, $CDIS_FOCUS ) Then
                                DllStructSetData( $tNMTVCUSTOMDRAW, "ClrText", $aTreeViewState[$iItemParam][1] )            ; Forecolor of item text
                                ;DllStructSetData( $tNMTVCUSTOMDRAW, "clrTextBk",$aTreeViewState[$iItemParam][1] )  ; Backcolor of item text

                                Local $tRECT = _GUICtrlTreeView_DisplayRectEx ( $hTreeView, $hItemSpec, True)
                                DllStructSetData( $tRECT, "Left", DllStructGetData( $tRECT, "Right") + 7)
                                DllStructSetData( $tRECT, "Right", DllStructGetData( $tRECT, "Right") + 188)


                                _WinAPI_DrawText( $hDC, $aTreeViewState[$iItemParam][3], $tRECT, $DT_LEFT ) ; and background color of the device context.
                                _GUICtrlTreeView_SetBold ($hTreeView, $hItemSpec, $aTreeViewState[$iItemParam][2])
                            ;Else
                                ;_GUICtrlTreeView_SetBold ($TreeView, $hItemSpec, $aTreeViewState[$iItemParam][2])
                            ;EndIf
                            Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors

                        Case $CDDS_ITEMPOSTPAINT
                            Local $hItemSpec  = DllStructGetData($tNMTVCUSTOMDRAW, "ItemSpec")          ; $hItemSpec = $hItem
                            Local $iItemState = DllStructGetData($tNMTVCUSTOMDRAW, "ItemState")
                            Local $iItemParam = DllStructGetData($tNMTVCUSTOMDRAW, "ItemParam")         ; ItemParam = index in array
                            Local $hDC        = DllStructGetData($tNMTVCUSTOMDRAW, "HDC")               ; Handle to the item's device context

                            Local $tRECT = _GUICtrlTreeView_DisplayRectEx( $hTreeView, $hItemSpec, True)
                            DllStructSetData( $tRECT, "Left", DllStructGetData( $tRECT, "Right") + 7)
                            DllStructSetData( $tRECT, "Right", DllStructGetData( $tRECT, "Right") + 188)

                            ;DllStructSetData( $tNMTVCUSTOMDRAW, "ClrText", $aTreeViewState[$iItemParam][1] )            ; Forecolor of item text
                            DllCall( "gdi32.dll", "int", "SetTextColor", "handle", $hDC, "int", 0xFEB577 ) ; 0x77B5FE
                            _WinAPI_SelectObject( $hDC, $aTreeViewState[$iItemParam][2] ? $hTreeViewFontBold : $hTreeViewFont ) ; Bold/normal font
                            _WinAPI_DrawText( $hDC, $aTreeViewState[$iItemParam][3], $tRECT, $DT_LEFT ) ; and background color of the device context.

                           _GUICtrlTreeView_SetBold ($hTreeView, $hItemSpec, $aTreeViewState[$iItemParam][2])

                           Return $CDRF_NEWFONT ; $CDRF_NEWFONT must be returned after changing font or colors

                    EndSwitch

                Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW
                    AdlibRegister("SubFunction_FillListView_Delayed",300)
                    _WinAPI_RedrawWindow($hTreeView)

                Case $NM_RCLICK
                    Local $tMPos = _WinAPI_GetMousePos(True, $hWndFrom)
                    Local $hItem = _GUICtrlTreeView_HitTestItem($hWndFrom, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
                    If $hItem <> -1 And $hItem <> 0x0 Then
                        DllCall("user32.dll", "int", "TrackPopupMenuEx", "hwnd", $hTVContextMenu, "int", 0, "int", MouseGetPos(0), "int", MouseGetPos(1), "hwnd", $Form1, "ptr", 0)
                    EndIf
            EndSwitch

        Case $hListView
            Switch $iCode
                Case $NM_CUSTOMDRAW
                    Local $tNMLVCUSTOMDRAW = DllStructCreate( $tagNMLVCUSTOMDRAW, $lParam )
                    $iItem = DllStructGetData( $tNMLVCUSTOMDRAW, "dwItemSpec" ) ; Item index
                    Switch DllStructGetData( $tNMLVCUSTOMDRAW, "dwDrawStage" )
                        Case $CDDS_PREPAINT                              ; Before the paint cycle begins
                            Return $CDRF_NOTIFYITEMDRAW                    ; Notify the parent window before an item is painted

                        Case $CDDS_ITEMPREPAINT                     ; Before an item is painted

                            If Mod( $iItem, 2 ) = 0 Then
                                DllStructSetData( $tNMLVCUSTOMDRAW, "ClrTextBk", 0xFFFFFF )
                            Else
                                DllStructSetData( $tNMLVCUSTOMDRAW, "ClrTextBk", 0xF8FFF8 )
                            EndIf
                            Return $CDRF_NOTIFYITEMDRAW

                        Case $CDDS_SUBITEM,BitOR($CDDS_ITEMPREPAINT, $CDDS_SUBITEM)                          ; Before an item is painted
                            $iSubItem = DllStructGetData($tNMLVCUSTOMDRAW, "iSubItem")                  ; Subitem index

                            If $iSubItem = 1 Then
                                Return $CDRF_NOTIFYPOSTPAINT
                            EndIf

                            If GUICtrlSendMsg( $idListView, $LVM_GETITEMSTATE, $iItem, $LVIS_SELECTED ) Then; Selected item
                                Return $CDRF_NOTIFYSUBITEMDRAW                 ; Custom drawing of selected items
                            EndIf

                            Return $CDRF_NEWFONT                           ; Default drawing of other items

                        Case $CDDS_ITEMPOSTPAINT,BitOR($CDDS_ITEMPOSTPAINT, $CDDS_SUBITEM)                          ; After an item has been painted
                            $hDC = DllStructGetData( $tNMLVCUSTOMDRAW, "hdc" ) ; Device context
                            $iSubItem = DllStructGetData($tNMLVCUSTOMDRAW, "iSubItem")                  ; Subitem index

                            If $iSubItem = 1 Then
                                $iItem = DllStructGetData( $tNMLVCUSTOMDRAW, "dwItemSpec" )
                                ; Subitem rectangle
                                DllStructSetData( $tRectLVI, "Top", $iSubItem )
                                DllStructSetData( $tRectLVI, "Left", $LVIR_ICON )
                                GUICtrlSendMsg( $idListView, $LVM_GETSUBITEMRECT, $iItem, $pRectLVI )
                                _GUIImageList_Draw( $hListView_ImageList, 0, $hDC, DllStructGetData( $tRectLVI, "Left" ), DllStructGetData( $tRectLVI, "Top" ) + 1 )
                                Return $CDRF_NEWFONT                           ; $CDRF_NEWFONT must be returned after changing font or colors
                            EndIf
                    EndSwitch

                Case $LVN_GETDISPINFOW
                    Local $tNMLVDISPINFO = DllStructCreate( $tagNMLVDISPINFO, $lParam )
                    Local $iItem    = DllStructGetData( $tNMLVDISPINFO, "Item" )
                    Local $iSubItem = DllStructGetData( $tNMLVDISPINFO, "SubItem" )
                    Local $iMask    = DllStructGetData( $tNMLVDISPINFO, "Mask" )

                    If BitAND( $iMask, $LVIF_TEXT ) Then
                        $iIndex = $iItem - $iFrom + 1
                        If $iIndex > 0 And $iIndex < $iRows + 1 Then
                            Local $sItem = $aResult[$iIndex][$iSubItem]
                            DllStructSetData( $tText, 1, $sItem )
                            DllStructSetData( $tNMLVDISPINFO, "Text", $pText )
                            DllStructSetData( $tNMLVDISPINFO, "TextMax", StringLen( $sItem ) )
                        EndIf
                    EndIf

                    If BitAND( $iMask, $LVIF_IMAGE ) And ($iSubItem = 1) Then
                        $iIndex = $iItem - $iFrom + 1
                        If $iIndex > 0 And $iIndex < $iRows + 1 Then
                            DllStructSetData( $tNMLVDISPINFO, "Image", 0)
                        EndIf
                    EndIf

                Case $LVN_ODCACHEHINT
                    Local $tNMLVCACHEHINT = DllStructCreate( $tagNMLVCACHEHINT, $lParam ), $iColumns
                    $iFrom = DllStructGetData( $tNMLVCACHEHINT, "iFrom" )
                    Local $sSQL = "SELECT DisplayView.Hash,Title,Date,Subject,IsRead,GroupTitle FROM DisplayView INNER JOIN RowRelation ON DisplayView.Hash = RowRelation.Hash WHERE RowRelation.rowid BETWEEN " & (DllStructGetData( $tNMLVCACHEHINT, "iFrom" ) + 1) & " And " & (DllStructGetData( $tNMLVCACHEHINT, "iTo" ) + 1) & ";"

                    _SQLite_GetTable2d( -1, $sSQL, $aResult, $iRows, $iColumns )

                Case $LVN_ODFINDITEMW
                    Local $tNMLVFINDITEM = DllStructCreate( $tagNMLVFINDITEM, $lParam )
                    
                    If BitAND( DllStructGetData( $tNMLVFINDITEM, "Flags" ), $LVFI_STRING ) Then
                        
                        Local $sSearchString = DllStructGetData( DllStructCreate( "wchar[512]", DllStructGetData( $tNMLVFINDITEM, "Text" ) ), 1 )
                        
                        If StringLen($sSearchString) > 3 Then
                            Return SearchText( DllStructGetData( $tNMLVFINDITEM, "Start" ), $sSearchString)
                        Else
                            Return -1
                        EndIf
                    EndIf

            EndSwitch

    EndSwitch

    Return $GUI_RUNDEFMSG
EndFunc
;==============================================================================================================================================================================================
Func SetIconListToListView()

    Local $hItemIcon_Item0   = _GDIPlus_BitmapCreateFromMemory(GetIcon_ListView_Item0(),   True)
    Local $hItemIcon_Item1 = _GDIPlus_BitmapCreateFromMemory(GetIcon_ListView_Item1(), True)
    Local $hItemIcon_Item2 = _GDIPlus_BitmapCreateFromMemory(GetIcon_ListView_Item2(), True)

    $hListView_ImageList = _GUIImageList_Create(16, 16, 5, 3)

    _GUIImageList_Add($hListView_ImageList, $hItemIcon_Item0)
    _GUIImageList_Add($hListView_ImageList, $hItemIcon_Item1)
    _GUIImageList_Add($hListView_ImageList, $hItemIcon_Item2)

    _GUICtrlListView_SetImageList($idListView, $hListView_ImageList, 1)

    _WinAPI_DeleteObject($hItemIcon_Item0)
    _WinAPI_DeleteObject($hItemIcon_Item1)
    _WinAPI_DeleteObject($hItemIcon_Item2)

EndFunc
;==============================================================================================================================================================================================
Func GetIcon_ListView_Item0()
    Local $AleciveFlatwokenAppsFileNewsico
    $AleciveFlatwokenAppsFileNewsico &= 'xrcAAAABAAIAICABAXAgAKgQAAAmMAAAABAAOAF4aARoAADOACwoAEwAiACuQAAMAVwoAAMABhcABqoxAAY8EAY7FAM6EAOqOQQDOAADKwADFQADAwChFgARDQ8PYksAV1a4c4SD3H9wk5LlgAADAQcGA5IqkYEB5IUBfoEBkZCVhQHjgQF9gQGQj4UBguKAJd1MV1a/gC0qf4AxP4ABD5A9Ej0AR0afp8C/+b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auwE/BCYmdnv+hALq4/z9IR4d4HojAD8AMwWTBALbR0ED/2OLa/9rAANsPwA7BAcUCwQaYr6//gIyhof+iu7rBDxCFeYiHwj+dtLRHwljBXMEBpLy9wAC8EcJbnbS1wHC4/9hA4+P/9fj4wgDTANbW5hkaGix7wIiIW77c2sJ84TaAjaCi/7POzeIAAIyfof+yzMz/AI2ho/+qw8P/CPP29mJr3d3d5hAeHh4tYV9gaGcAIcDb2fuQpaYc/6RgDeFA4TOVqqwj4iThHZ+3t2JW9vkK+WUHLIlvtcXEbBDJ5OL7fWfW2tkK5WAHKxF4Z25uIQCJk5JaiZSTXxVhAIpmAJRkAJNfJ8goKCTtBoABY4ofABMEAOAFAANgBgcAAADADwAA'
    $AleciveFlatwokenAppsFileNewsico = _WinAPI_Base64Decode($AleciveFlatwokenAppsFileNewsico)
    Local $tSource = DllStructCreate('byte[' & BinaryLen($AleciveFlatwokenAppsFileNewsico) & ']')
    DllStructSetData($tSource, 1, $AleciveFlatwokenAppsFileNewsico)
    Local $tDecompress
    _WinAPI_LZNTDecompress($tSource, $tDecompress, 5430)
    $tSource = 0
    Return Binary(DllStructGetData($tDecompress, 1))
EndFunc
;==============================================================================================================================================================================================
Func GetIcon_ListView_Item1()
    Local $AleciveFlatwokenAppsUnlockico
    ;$AleciveFlatwokenAppsUnlockico &= 'NbYAAAABAAIAICABAXAgAKgQAAAmMAAAABAAOAF4aARoAADOACwoAEwAiACuQAAMAVwoAAMABhYABqowAAY7AAY8QAY6AAM6KwADFAADAKEWABACAAkPYRA3VrcYAFWF3BtfluUbKGCX5gMDlgIDGlsAj+YVSnTmFUkCc6QBcuUTQWbdAAwqQr4CBwx+FYAxP4ABD5A9Eg4uAEefJ4DG+SyToOX/LZrwgAHxigEALJXo/yR6vv8IIna4rAG3/yFxAK//HmKX+QskFDe0gDVQjEECEDAASZEukd7+L5wg8P8vnPGOAS2WAOj/JXu+/yR3Arj4ALf/I2+q/lANJTmzwBw9xWIFAA4VLy6L0vgwCJ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qubbwgm97eVw/67p38IAwQIBAKMA0sn/LpaD/y4AnYf/Nbug/xkASD6IMXZoXzkQwaf/O8AOPsmvEP9IzbXCCmfZxXD/Q9G5wgDBAgEAOQCfjf8yo47/OgDBqP84wKb/GwBJQIc1eGtfOgDEqf89yK7/QEDMsv9G0LjAQP4A/3Pfzf9H178HwgDBAsE+OaqX/z4AyK//PMet/zoAw6j/HkpChTkIem1fwh7KsP9BAM61/0TSuv/CAPHp/9n38v9zBOPRwgDZ9vL/wADr5P9Czrb/QATNtMAar/87xKoA/x9LQ4Q/e28AWzzGrP8/yrEA/0LPtv9F07sA/1Haw/+58egQ//X9+2IAufDoMP9R2cJiC2EMPskC'
    $AleciveFlatwokenAppsUnlockico &= 'sOIdIkpCfTtfQFghSsqy++YP0wK6YhZJ28T/S90ix2AAxv9J4AlG1oC+/0PSuf9B4A8B4iTGrvwSHRs/AeFnbrapbFTPuIr7YRND4B9F1LxiCFhI2MFiAGEHROASQgTPt2IkUsu1/DQoXFWFQAcCZXBFaABiIVyMg1tdjgCFX16Phl9ekOCHX1+QiGIAYQFhAgFhA1aBeVwcKifyKeUGgAHjhx8ACwBijgADAAA='

    $AleciveFlatwokenAppsUnlockico = _WinAPI_Base64Decode($AleciveFlatwokenAppsUnlockico)
    Local $tSource = DllStructCreate('byte[' & BinaryLen($AleciveFlatwokenAppsUnlockico) & ']')
    DllStructSetData($tSource, 1, $AleciveFlatwokenAppsUnlockico)
    Local $tDecompress
    _WinAPI_LZNTDecompress($tSource, $tDecompress, 5430)
    $tSource = 0
    Return Binary(DllStructGetData($tDecompress, 1))
EndFunc
;==============================================================================================================================================================================================
Func GetIcon_ListView_Item2()
    Local $AleciveFlatwokenAppsMahjonggico
    $AleciveFlatwokenAppsMahjonggico &= 'bLgAAAABAAIAICABAXAgAKgQAAAmMAAAABAAOAF4aARoAADOACwoAEwAiACuQAAMAVwoAAMABhYABqowAAY7AAY8QAY6AAM6KwADFAADAKEWABAKAA0OYThNULdWAHd83GGGi+V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HBEBHBIX+zu8IgMUNGQIxdf4NfmsQejkDN2/+IyNrCDn4AwNf/TXG9/2gAoLT/aqK1/24cpbbCIcEywSCDtb0A/zVIS4tfgIUiX8E9ktDdwi2GxgDZ/3/B1/96vQDV/0Bet/9jnQCz/2eftP9soxC1/3GnwCCsuP8AfLC6/5HK0/8AO1FUimGBhl9GmMQPwS6ExdnCHncAutP/M0mv/15Al7H/ZZ6zwiBwgcEPq7n/isXQwlqAPFFUiWKChsYfBcEPhcQfR2i4/yMALab/PVqu/1Awea//a8EfwECEwAbPwgrBDD1SVIhkTIOHwj/Beo3Mw06BAMLX/0JeuP8qADes/3Gv0f8jACun/2mdtf+ANL3OwgiUwArBDD5S4FWHZoOIw1/AjMFuAIrK2v9+u9X/AD9Ytv8eIqb/ADJErv8mMKf/6HWty8IGkMBowQrBDJHAD4VohMEP4P/BQA/BIMFgwQnBISIpqP/oZJS0wB3NwgTBlMEIA8EuwQw/U1WEaoTYiFucwI/BE5dgQOEDAo9kSCUsqf9woH7LYhZhAmEDYQRhBWEGPwBQUn1VZWchowja4vtlCJjV3v/+lWBBYSThSWEAYQFhAmEDAWUHoNff/BoeHwI/4WehwMVsp9z+42YIYSNhBWENYQBhAWECAWUHpNng/FBiZAqFQAcCZXBdbG4hAHyQk1t8kZRf'
    $AleciveFlatwokenAppsMahjonggico &= 'BXEAfWQAc4WIXCbIKywp5QaAAeOHHwADCwBijgMAAA=='
    $AleciveFlatwokenAppsMahjonggico = _WinAPI_Base64Decode($AleciveFlatwokenAppsMahjonggico)
    Local $tSource = DllStructCreate('byte[' & BinaryLen($AleciveFlatwokenAppsMahjonggico) & ']')
    DllStructSetData($tSource, 1, $AleciveFlatwokenAppsMahjonggico)
    Local $tDecompress
    _WinAPI_LZNTDecompress($tSource, $tDecompress, 5430)
    $tSource = 0
    Return Binary(DllStructGetData($tDecompress, 1))
EndFunc
;==============================================================================================================================================================================================
Func _WinAPI_Base64Decode($sB64String)
    Local $aCrypt = DllCall($hDLL_Crypt32, "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "")
    Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]")
    $aCrypt = DllCall($hDLL_Crypt32, "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0)
    If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "")
    Return DllStructGetData($bBuffer, 1)
EndFunc   ;==>_WinAPI_Base64Decode
;==============================================================================================================================================================================================
Func _WinAPI_LZNTDecompress(ByRef $tInput, ByRef $tOutput, $iBufferSize)
    $tOutput = DllStructCreate("byte[" & $iBufferSize & "]")
    If @error Then Return SetError(1, 0, 0)
    Local $aRet = DllCall($hDLL_ntdll, "uint", "RtlDecompressBuffer", "ushort", 0x0002, "struct*", $tOutput, "ulong", $iBufferSize, "struct*", $tInput, "ulong", DllStructGetSize($tInput), "ulong*", 0)
    If @error Then Return SetError(2, 0, 0)
    If $aRet[0] Then Return SetError(3, $aRet[0], 0)
    Return $aRet[6]
EndFunc   ;==>_WinAPI_LZNTDecompress
;==============================================================================================================================================================================================
Func CreateDB( $iRows = 100000 )

    ConsoleWrite("Generating DB..." & @CRLF)

    _SQLite_Startup()
    _SQLite_Open( "Test.sqlite" )

    _SQLite_Exec( -1, "PRAGMA synchronous = OFF;" )

    Local $sSQL = "CREATE TABLE lvdata " & $sSqlBuild_Table & ";"
    _SQLite_Exec( -1, $sSQL )

    $iRows = $iRows/$aTreeViewState[0][0]

    Local $n = ($iRows > 888)?(8888):(888), $p = 0, $q = -1

    Local $sItemTitle,$sItemDate,$sItemSubject,$iItemTimeStamp

    For $f = 1 To $aTreeViewState[0][0]

        $sGroupTitle = $aTreeViewState[$f][5]

        $aTreeViewState[$f][3] = 0

        For $i = 0 To $iRows-1 Step $n

            $k = (($i+$n) > $iRows) ? ($iRows-$i-2) : ($n-2)

            $sQuery  = 'INSERT OR IGNORE INTO lvdata ' & $sSqlFill_Table & ' VALUES '

            For $j = 0 To $k

                $iItem = $i+$j

                $aTreeViewState[$f][3] += 1

                $sItemTitle     = "Item Title " & $f & "-" & $iItem
                $sItemDate      = "08.08.8888"
                $sItemSubject   = "Any"
                $iItemTimeStamp = 155888333 - $iItem

                $sHash          = $sGroupTitle & $sItemTitle & $iItemTimeStamp

                $sQuery &= "('" & $sGroupTitle & "','" & $sHash & "','" & $sItemTitle & "','" & $sItemDate & "','" & $sItemSubject & "'," & $iItemTimeStamp & "),"
            Next

            $iItem = $i+$k+1

            $aTreeViewState[$f][3] += 1

            $sItemTitle     = "Item Title " & $f & "-" & $iItem
            $sItemDate      = "08.08.8888"
            $sItemSubject   = "Any"
            $iItemTimeStamp = 155888333 - $iItem

            $sHash          = $sGroupTitle & $sItemTitle & $iItemTimeStamp

            $sQuery &= "('" & $sGroupTitle & "','" & $sHash & "','" & $sItemTitle & "','" & $sItemDate & "','" & $sItemSubject & "'," & $iItemTimeStamp & ");"

            If Not (_SQLite_Exec(-1, $sQuery) = $SQLITE_OK) Then
                MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Error Code: " & _SQLite_ErrCode() & @CRLF & "Error Message: " & _SQLite_ErrMsg() & @CRLF &  @CRLF & "Cancelling table generation...")
                Return SetError(5)
            EndIf
        Next
    Next

    _SQLite_Close( -1 )

    ConsoleWrite("Generating DB... Done." & @CRLF)
EndFunc

Func ControlCreateFonts(ByRef $hWndCTRL, ByRef $hFont, ByRef $hFontBold)

    Local $hDC = _WinAPI_GetDC( $hWndCTRL )
    $hFont = _SendMessage( $hWndCTRL, $WM_GETFONT )
    Local $hObject = _WinAPI_SelectObject( $hDC, $hFont )
    Local $lvLOGFONT = DllStructCreate( $tagLOGFONT )
    DllCall( 'gdi32.dll', 'int', 'GetObjectW', 'ptr', $hFont, 'int', DllStructGetSize( $lvLOGFONT ), 'ptr', DllStructGetPtr( $lvLOGFONT ) )
    _WinAPI_SelectObject( $hDC, $hObject )
    _WinAPI_ReleaseDC( $hWndCTRL, $hDC )
    $TreeViewFont = _WinAPI_CreateFontIndirect( $lvLOGFONT )
    Local $iWeight = BitOR( DllStructGetData( $lvLOGFONT, "Weight" ), $FW_BOLD )
    DllStructSetData( $lvLOGFONT, "Weight", $iWeight )
    $hFontBold = _WinAPI_CreateFontIndirect( $lvLOGFONT )

EndFunc

Thanks!

Idea is to send LVM_FINDITEM message from another thread and make ListView jump to the found item in currently loaded items (selected GroupTitle). Ideally ListView should not react/search to strings shorter than 3 letters, only valid keys - arrow keys for navigation

 

Link to comment
Share on other sites

  • 3 months later...

Hi  LarsJ,

Please refer to the attachment.

Question is based on the virtual listview database model.

1. How to fix the customdraw problem?

2.  In order to get the listview subitem ID, I have to regist the listview callback function, any other good idea?

3. How to get Item/subitem data form virtual listview in NM_CLICK?

 

Thanks

Regards

 

Virtual listview customdraw problem.rar

Edited by powerofos
Link to comment
Share on other sites

Subbed.

Thanks for this LarsJ, I've shaved 12 seconds off of my time loading a 35,000 x 10 array into a listview (was also some optimisations in the removal of blank rows from the array at the same time, but making the listview dynamic has saved most of that time).

 

EDIT: Huh I was already subbed but wasn't receiving notifications. Well, a different means to the same end... Now to get the incremental search working

Edited by Inpho
Link to comment
Share on other sites

  • 2 months later...

Hi, last days i use virtual listview and i have a problem, i can't get item text (_GUICtrlListView_GetItemText ) from selected item

If i use msgbox in WM_Notify, when select a item, then return NULL, but the 2nd msgbox return current result 

#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <Array.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>



;Opt( "MustDeclareVars", 1 )

Global $hGui, $hEdit, $idEditSearch, $hLV, $iItems = 1000, $aItems[$iItems], $aSearch[$iItems], $iSearch = 0

Example()


Func Example()
  ; Create GUI
  $hGui = GUICreate( "Virtual ListView search", 300, 230 )

  ; Create Edit control
  Local $idEdit = GUICtrlCreateEdit( "", 10, 10, 300-20, 20, BitXOR( $GUI_SS_DEFAULT_EDIT, $WS_HSCROLL, $WS_VSCROLL ) )
  $hEdit = GUICtrlGetHandle( $idEdit )
  $idEditSearch = GUICtrlCreateDummy()

  ; Handle $WM_COMMAND messages from Edit control
  ; To be able to read the search string dynamically while it's typed in
  GUIRegisterMsg( $WM_COMMAND, "WM_COMMAND" )

  ; Create ListView
  Local $idLV = GUICtrlCreateListView( "", 10, 40, 300-20, 200-20, $LVS_OWNERDATA, BitOR( $WS_EX_CLIENTEDGE, $LVS_EX_DOUBLEBUFFER, $LVS_EX_FULLROWSELECT ) )
  $hLV = GUICtrlGetHandle( $idLV ) ;                               Virtual listview                          Reduces flicker
  _GUICtrlListView_AddColumn( $hLV, "Items",  250 )

  ; Handle $WM_NOTIFY messages from ListView
  ; Necessary to display the rows in a virtual ListView
  GUIRegisterMsg( $WM_NOTIFY, "WM_NOTIFY" )

  ; Show GUI
  GUISetState( @SW_SHOW )

  ; Fill array
  FillArray( $aItems, $iItems )
  _ArraySort( $aItems, 0, 0, 0, 0, 1 )

  ; Set search array to include all items
  For $i = 0 To $iItems - 1
    $aSearch[$i] = $i
  Next
  $iSearch = $iItems

  ; Display items
  GUICtrlSendMsg( $idLV, $LVM_SETITEMCOUNT, $iSearch, 0 )

  ; Message loop
  While 1
    Switch GUIGetMsg()
      Case $idEditSearch
        Local $sSearch = GUICtrlRead( $idEdit )
        If $sSearch = "" Then
          ; Empty search string, display all rows
          For $i = 0 To $iItems - 1
            $aSearch[$i] = $i
          Next
          $iSearch = $iItems
        Else
          ; Find rows matching the search string
          $iSearch = 0
          For $i = 0 To $iItems - 1
            ;If StringInStr( $aItems[$i], $sSearch ) Then ; Normal search
            If StringRegExp( $aItems[$i], $sSearch ) Then ; Reg. exp. search
              $aSearch[$iSearch] = $i
              $iSearch += 1
            EndIf
          Next
        EndIf
        GUICtrlSendMsg( $idLV, $LVM_SETITEMCOUNT, $iSearch, 0 )
        ConsoleWrite( StringFormat( "%4d", $iSearch ) & " rows matching """ & $sSearch & """" & @CRLF )

      Case $GUI_EVENT_CLOSE
        ExitLoop
    EndSwitch
  WEnd

  GUIDelete()
EndFunc

Func FillArray( ByRef $aItems, $iRows )
  Local $aLetters[26] = [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', _
                          'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ]
  Local $s
  For $i = 0 To $iRows - 1
    $s = $aLetters[Random(0,25,1)]
    For $j = 1 To Random(10,30,1)
      $s &= $aLetters[Random(0,25,1)]
    Next
    $aItems[$i] = $s
  Next
EndFunc

Func WM_COMMAND( $hWnd, $iMsg, $wParam, $lParam )
  Local $hWndFrom = $lParam
  Local $iCode = BitShift( $wParam, 16 ) ; High word
  Switch $hWndFrom
    Case $hEdit
      Switch $iCode
        Case $EN_CHANGE
          GUICtrlSendToDummy( $idEditSearch )
      EndSwitch
  EndSwitch
  Return $GUI_RUNDEFMSG
EndFunc

Func WM_NOTIFY( $hWnd, $iMsg, $wParam, $lParam )
  Local Static $tText = DllStructCreate( "wchar[50]" )
  Local Static $pText = DllStructGetPtr( $tText )

  Local $tNMHDR, $hWndFrom, $iCode,$tInfo
  $tNMHDR = DllStructCreate( $tagNMHDR, $lParam )
  $hWndFrom = HWnd( DllStructGetData( DllStructCreate( $tagNMHDR, $lParam ), "hWndFrom" ) )
  $iCode = DllStructGetData( $tNMHDR, "Code" )

  Switch $hWndFrom
    Case $hLV
      Switch $iCode
        Case $LVN_GETDISPINFOW
          Local $tNMLVDISPINFO = DllStructCreate( $tagNMLVDISPINFO, $lParam )
          If BitAND( DllStructGetData( $tNMLVDISPINFO, "Mask" ), $LVIF_TEXT ) Then
            Local $sItem = $aItems[$aSearch[DllStructGetData($tNMLVDISPINFO,"Item")]]
            DllStructSetData( $tText, 1, $sItem )
            DllStructSetData( $tNMLVDISPINFO, "Text", $pText )
            DllStructSetData( $tNMLVDISPINFO, "TextMax", StringLen( $sItem ) )
          EndIf
          Case $LVN_ITEMCHANGED
                $tNMHDR = DllStructCreate("hwnd;uint;uint;int iItem;int;uint iNewState;uint;uint;long;long;lparam", $lparam)
    
                If BitAND(DllStructGetData($tNMHDR, "iNewState"), $LVIS_SELECTED) Then
                    Local $tNMLISTVIEW = DllStructCreate( $tagNMLISTVIEW, $lParam )
                    $iSelItem = DllStructGetData( $tNMLISTVIEW, "Item" )

                    MsgBox(0,$iSelItem,_GUICtrlListView_GetItemText($hLV,$iSelItem))
                    MsgBox(0,$iSelItem,_GUICtrlListView_GetItemText($hLV,$iSelItem))


              EndIf


      EndSwitch
  EndSwitch

  Return $GUI_RUNDEFMSG
EndFunc

 

Edited by banged
Link to comment
Share on other sites

Iczer, I don't think your functionality can be coded using LVN_ODFINDITEM notifications. It's much easier to use an input control or similar.

 

powerofos
1. Use this line at the bottom of the code:

_WinAPI_DrawText( $hDC, $aResult[$iItem-$iFrom+1][$iSubItem], $tRect, $DT_WORD_ELLIPSIS ) ; Draw text

3. In the NM_CLICK code, you can extract item (=index) and subitem from the tagNMITEMACTIVATE structure. Then you can read data from $aResult as in the code line above.

2. Since you have already determined both item and subitem in the NM_CLICK code, you do not need any subclassing code.

 

banged, In a virtual listview, data isn't stored in items/subitems. Data is only stored in the data source. Therefore, _GUICtrlListView_GetItemText doesn't work. Read data directly from the source as you do in the LVN_GETDISPINFOW code.

Link to comment
Share on other sites

  • 6 months later...

What a difference this method vs standard. It even can handle tens individual insertions a second. A bit visually not pleasant, but at least it's responsive.

I have dynamic list array it's being populated via SHELLHOOK event and could change several times a second, what's the best way prevent it from flickering and how to automatically scroll it to the last item?

 

[EDIT]

So far I'm using this method:
 

;disable screen update

GUICtrlSendMsg( $gListview, $WM_SETREDRAW, False, 0)

;scroll to the last item

GUICtrlSendMsg( $gListview, $LVM_SETITEMCOUNT, Ubound($list)-1, $LVSICF_NOSCROLL + $LVSICF_NOINVALIDATEALL)

;enable screen update

GUICtrlSendMsg( $gListview, $WM_SETREDRAW, True, 0)

Works decent, still scroll kind of distorted.

Edited by VAN0
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...