All programs I currently code in PureBasic are extremely fast and compact, but there is still a small and simple routine for copying TXT lines from a "Listview gadget" which is very... but very slow by PureBasic standards.
I'm going to put a small example here, so someone can help me do it faster, see:
Code: Select all
DisableDebugger
Enumeration
#Window_0
#Button_0
#Button_1
#Button_2
#Listview_0
#Text_1
#Text_2
EndEnumeration
OpenWindow(#Window_0, 380, 150, 771, 536, "Putting strings in and out of a ListView Gadget", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
ButtonGadget(#Button_0, 700, 500, 60, 25, "E X I T")
ButtonGadget(#Button_1, 100, 100, 120, 25, "Putting IN")
ButtonGadget(#Button_2, 100, 130, 120, 25, "OUT to ClipBoard")
TextGadget(#Text_1, 200, 104, 200, 20, "",#PB_Text_Right)
TextGadget(#Text_2, 200, 134, 200, 20, "",#PB_Text_Right)
ListViewGadget(#Listview_0, 10, 240, 750, 250)
Global.i i,j,Quit,limit,t1,t2
Global.s aux,lf
limit=10000
lf=Chr(13)+Chr(10)
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_Event_CloseWindow
Quit = 1
EndIf
If EventID = #PB_Event_Gadget
Select EventGadget()
Case #Button_0
Quit=1
Case #Button_1
t1 = ElapsedMilliseconds()
ClearGadgetItems(#Listview_0)
For i=1 To limit: AddGadgetItem(#Listview_0,-1,"PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic PureBasic"): Next
t2 = ElapsedMilliseconds()
While WindowEvent(): Wend: SetGadgetText(#Text_1,Str(t2-t1)+" ms")
Case #Button_2
t1 = ElapsedMilliseconds()
aux="": j=CountGadgetItems(#Listview_0)-1: For i=0 To j: aux+GetGadgetItemText(#Listview_0,i)+lf: Next
SetClipboardText(aux)
t2 = ElapsedMilliseconds()
SetGadgetText(#Text_2,Str((t2-t1)/1000)+" s")
EndSelect
EndIf
Until Quit = 1
Any ideas to speed up these processes?