I don't have a specific functionality issue per se, however the speed at which I'm adding to a ListView is less than ideal.
I'm populating a ListView from a SQLite recordset with IsNull's great AHK DBA OOP lib. I'm expecting up to a few thousand items (MAX) being populated, and the speed is going to be a limiting factor for end user productivity.
Here's the code:
Code: Select all
ShowRecordSet( LVname, resultSet ){
GuiControl, -ReDraw, %LVname%
Gui, ListView, %LVname%
if(!is(resultSet, DBA.RecordSet))
throw Exception("RecordSet Object expected! resultSet was of type: " typeof(resultSet) ,-1)
; Delete existing data
LV_Delete()
Loop, % LV_GetCount("Column")
LV_DeleteCol(1)
; fetch new data
columns := resultSet.getColumnNames()
columnCount := columns.Count()
for each, colName in columns
LV_InsertCol(A_Index,"", colName)
while(!resultSet.EOF){
rowNum := LV_Add("", "")
Loop, % columnCount
LV_Modify(rowNum, "Col" . A_index, resultSet[A_index])
resultSet.MoveNext()
}
LV_ModifyCol()
LV_ModifyCol(2,0)
LV_ModifyCol(3,175)
LV_ModifyCol(6,175)
LV_ModifyCol(7,175)
GuiControl, +ReDraw, %LVname%
return
}
-Indexed an additional field in the DB
-Limited the text length of a specific field with SubStr in SQLite
-Reduced the number of columns outputted from 11 to 9
I got a bit of speed bump doing these revisions, however it's fairly moderate. Also, I'm not entirely sure if it is the recordset being slow, the ListView addition...or something else.
Any recommendations/insights would be great!