GFFastList/Testfrm.frm
VERSION 5.00
Begin VB.Form Testfrm
Caption = "GFFastList"
ClientHeight = 4575
ClientLeft = 60
ClientTop = 465
ClientWidth = 7095
LinkTopic = "Form1"
ScaleHeight = 4575
ScaleWidth = 7095
StartUpPosition = 3 'Windows‑Standard
Begin VB.CommandButton Command6
Caption = "RL 1"
Height = 377
Left = 6357
TabIndex = 5
ToolTipText = "Reload with 1 item"
Top = 4134
Width = 689
End
Begin Project1.GFFastListctl GFFastList1
Height = 3975
Left = 60
TabIndex = 6
Top = 60
Width = 6975
_ExtentX = 12303
_ExtentY = 7011
End
Begin VB.CommandButton Command5
Caption = "Refresh"
Height = 375
Left = 5100
TabIndex = 4
Top = 4140
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "Clear"
Height = 375
Left = 3840
TabIndex = 3
Top = 4140
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "Add"
Height = 375
Left = 2580
TabIndex = 2
Top = 4140
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "Remove"
Height = 375
Left = 1320
TabIndex = 1
Top = 4140
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "Change"
Height = 375
Left = 60
TabIndex = 0
Top = 4140
Width = 1215
End
End
Attribute VB_Name = "Testfrm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'(c)2002, 2004 by Louis.
'
'Downloaded from www.louis‑coder.com.
'This is a kind of ListBox that is used to display data very quickly.
'You cannot mark any item, the list was designed for DISPLAYING data only.
'If you got bored by the lame Windows ListBox that reloads and redraws all
'the time when adding an item, then use this FastList.
'When manipulating the list content then always call FastList.Redraw_Disable,
'add/remove items and then call FastList.Redraw_Enable to redraw the list.
'You can add more than 32767 items, if you do, the minimal scroll step will
'be larger than 1. The color support doesn't work, please don't enable it.
'If you have questions, then mail louis@louis‑coder.com.
Private Sub Form_Load()
'on error resume next
Dim Temp As Long
Dim TimerOld As Single
'begin
TimerOld = Timer
Call GFFastList1.Initialize(ScrollStep:=5) 'scroll 5 lines at once
Call GFFastList1.Redraw_Disable
For Temp = 1 To 40000
GFFastList1.Add String$(Int((100 ‑ 1 + 1) * Rnd(1) + 1), "a")
Next Temp
Call GFFastList1.Redraw_Enable
MsgBox Timer ‑ TimerOld
End Sub
Private Sub Command1_Click()
'on error resume next
GFFastList1.List(0) = "Test"
End Sub
Private Sub Command2_Click()
'on error resume next
GFFastList1.Remove 2
End Sub
Private Sub Command3_Click()
'on error resume next
GFFastList1.Redraw_Disable
GFFastList1.Add "Test" 'Index is not supported
GFFastList1.Redraw_Enable 'verify scroll pos
End Sub
Private Sub Command4_Click()
'on error resume next
GFFastList1.Clear
End Sub
Private Sub Command5_Click()
'on error resume next
Dim TimerOld As Single
Dim Temp As Long
'begin
TimerOld = Timer
Call GFFastList1.Redraw_Disable
For Temp = 1 To 10000
GFFastList1.List(Temp ‑ 1) = LTrim$(Str$(Temp))
Next Temp
Call GFFastList1.Redraw_Enable
MsgBox Timer ‑ TimerOld
End Sub
Private Sub Command6_Click()
'on error resume next
Dim TimerOld As Single
Dim Temp As Long
'
'NOTE: the list must scroll up so that the last item is visible
'(if decreasing the item count because of reload).
'
'begin
TimerOld = Timer
Call GFFastList1.Redraw_Disable
Call GFFastList1.Clear 'reset
For Temp = 1 To 1
GFFastList1.Add CStr(Temp)
Next Temp
Call GFFastList1.Redraw_Enable
MsgBox Timer ‑ TimerOld
End Sub
[END OF FILE]