Sign in to follow this  
Followers 0
mark2004

Efficiently populating a listview

25 posts in this topic

I have a listview that I must populate with sometimes upwards of 2000 items. I am doing it with GUICtrlCreateListViewItem and

it takes a huge amount of time (maybe 10 seconds). The listview has 3 columns so I don't think I could just create a long delimited string and use that in the GUICtrlCreateListView command. Or maybe I could, I just don't know how.

If anyone knows of a way to speed this process up, I'd love to learn it!!!

Thanks.

Share this post


Link to post
Share on other sites



I have a listview that I must populate with sometimes upwards of 2000 items. I am doing it with GUICtrlCreateListViewItem and

it takes a huge amount of time (maybe 10 seconds). The listview has 3 columns so I don't think I could just create a long delimited string and use that in the GUICtrlCreateListView command. Or maybe I could, I just don't know how.

If anyone knows of a way to speed this process up, I'd love to learn it!!!

Thanks.

I haven't tried this but it might be that the reason it takes a long time is that every time you add an item the listview gets redrawn. I've had this problem with text boxes.

To see if this is the reason you could try making it invisible, add the items, then make it visible again.

Also, make sure you haven't got LVS_SORTASCENDING or LVS_SORTDESCENDING set when you are adding items because this takes up a lot of time.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Well, the hide/show trick speeds it up considerably. Gets it down to maybe 4-5 seconds. I do have the $LVS_SORTASCENDING style set for this listview BUT I actually need the items to be sorted. Is there a way to turn off this style temporarily while I'm populating the listview and then turn it back on when I'm done so that it is only sorted once???

I'd love to get this down to less than a second but I don't know If I'm asking too much......

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I just did a test and it took less than 1 second to add 2000 items, so it would be nice if you could

show a simple code that reproduces this. But I would suggest you to try using GUISetState with

@SW_LOCK.

@SW_LOCK = Lock the window to avoid repainting.

@SW_UNLOCK = Unlock windows to allow painting.

Edited by Helge

Share this post


Link to post
Share on other sites

When you create the list view don't use the style setting, then...

GUICtrlSetStyle ( controlID, style [, exStyle] )

afterwards

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

Well, the hide/show trick speeds it up considerably. Gets it down to maybe 4-5 seconds. I do have the $LVS_SORTASCENDING style set for this listview BUT I actually need the items to be sorted. Is there a way to turn off this style temporarily while I'm populating the listview and then turn it back on when I'm done so that it is only sorted once???

I'd love to get this down to less than a second but I don't know If I'm asking too much......

I used ListView many times in my projects and instead of $LVS_SORTASCENDING style I prepared data into global $data[] array. This array can be sorted by _ArraySort().

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I'm reading 17 different files, and from those files, adding 5000 items to a listview (with SHOWSELALWAYS and GRIDLINES). Takes 7 secs.

Edited by xcal

Share this post


Link to post
Share on other sites

Sorry for the delayed response. I've been away from the computer...

I tried using all the suggestions and nothing seems to fix it.

Here is a watered down version of my code. The list is populated when you click on the "Paid Cases" Radio Button. This occurs in the "Populate_MasterPaidList" Function.

When I use the Hide/Show for the control, it speeds it up to 4-5 seconds. When I use the @SW_LOCK/@SW_UNLOCK for the GUI,

the control is not updated at all and nothing happens. I cannot use an array since it is a multi-column list (at least I haven't figured out how to make that work.....)

I'll take any and all suggestions!!!

#include <GuiListView.au3>
#include <GUIConstants.au3>
#include <file.au3>
#include <date.au3>
#include <GuiList.au3>
#Include <GuiTab.au3>
#include <GuiCombo.au3>

Global $paidlist
Global Const $WM_NOTIFY = 0x004E
Global Const $DebugIt = 1
Global Const $DTM_FIRST = 0x1000
Global Const $DTM_SETSYSTEMTIME = $DTM_FIRST+2
Global Const $GDT_NONE = 1
Global Const $GDT_VALID = 0




Dim $opencasefile[50]
Dim $paidcasefile[50]
Dim $closedcasefile[50]
Dim $MJTData[40]
Dim $monthvec[13]=[0,0,31,59,90,120,151,181,212,243,273,304,334]
Dim $openlistarray[150]
Dim $openlistitem[150]
Dim $closedlistarray[150]
Dim $closedlistitem[150]
Dim $paidlist[1000]
Dim $categlabels[4]=["","Tech","Travel","Train"]

$counter=0
$markassignedamountmonth=0
$markassignedhoursmonth=0
$jennaassignedamountmonth=0
$jennaassignedhoursweek=0
$markassigneamountytd=0
$markassignedhoursytd=0
$jennaassigneamountytd=0
$jennaassignedhoursytd=0
$closedorpaid="closed"

#Region ### START Koda GUI section ### Form=c:\mark\programs\mjtmanager\mjtform.kxf
$MJTManager = GUICreate("MJTManager", 1016, 687, 2, 11)
$TABPanel = GUICtrlCreateTab(8, 47, 995, 633)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$MainTab = GUICtrlCreateTabItem("Main")
$Group3 = GUICtrlCreateGroup("", 16, 78, 322, 207)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$CaseFilterLabel = GUICtrlCreateLabel("Case Filters", 118, 90, 107, 27)
GUICtrlSetFont(-1, 16, 400, 6, "Times New Roman")
$CaseTypeFilter = GUICtrlCreateCombo("", 26, 138, 177, 25)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$WorkedByFilter = GUICtrlCreateCombo("", 223, 138, 105, 25)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$SourceFilter = GUICtrlCreateCombo("", 26, 186, 165, 25)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label7 = GUICtrlCreateLabel("Case Type", 82, 118, 66, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label8 = GUICtrlCreateLabel("Worked By", 243, 118, 69, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label9 = GUICtrlCreateLabel("Source", 86, 166, 45, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Input2 = GUICtrlCreateInput("", 207, 186, 121, 24)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label10 = GUICtrlCreateLabel("Title Contains", 227, 166, 83, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label11 = GUICtrlCreateLabel("Date Range:", 19, 226, 76, 20, $SS_RIGHT)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$FromDateFilter = GUICtrlCreateDate("2005/11/12 23:49:42", 100, 223, 97, 24, $WS_TABSTOP)
$ToDateFilter = GUICtrlCreateDate("2006/11/12 21:01:1", 233, 223, 97, 24, $WS_TABSTOP)
$ApplyFilters = GUICtrlCreateButton("Apply", 144, 254, 54, 22, 0)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label41 = GUICtrlCreateLabel("To:", 204, 227, 22, 20, $SS_RIGHT)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group4 = GUICtrlCreateGroup("", 16, 286, 321, 381)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$ClosedPaidList = GUICtrlCreateListView("Days |Case Name                           |Amount", 24, 334, 303, 325, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS))
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$ClosedRadio = GUICtrlCreateRadio("Closed Cases", 30, 301, 139, 27)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetFont(-1, 16, 400, 2, "Times New Roman")
$PaidRadio = GUICtrlCreateRadio("Paid Cases", 200, 301, 122, 27)
GUICtrlSetFont(-1, 16, 400, 2, "Times New Roman")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("", 347, 78, 323, 589)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Opencaselabel = GUICtrlCreateLabel("Open Cases", 460, 90, 105, 27, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 6, "Times New Roman")
$Opencaselist = GUICtrlCreateListView("Days|Case Name|Amount", 354, 122, 307, 505, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$LVS_SORTDESCENDING))
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$EnterNewCase = GUICtrlCreateButton("Enter New Case", 449, 635, 113, 23, 0)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("", 677, 78, 317, 233)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Quick Stats", 704, 94, 102, 27, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 6, "Times New Roman")
$YearCombo = GUICtrlCreateCombo("", 833, 93, 81, 25)
$Label1 = GUICtrlCreateLabel("Month", 788, 130, 39, 20)
GUICtrlSetFont(-1, 10, 400, 6, "Arial")
$Label3 = GUICtrlCreateLabel("   YTD   ", 880, 130, 54, 20)
GUICtrlSetFont(-1, 10, 400, 6, "Arial")
$Label4 = GUICtrlCreateLabel("Hrs Billed:", 687, 154, 64, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$HoursBilledmonth = GUICtrlCreateLabel("100/100", 776, 154, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$HoursBilledYTD = GUICtrlCreateLabel("100000", 873, 154, 46, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label12 = GUICtrlCreateLabel("Hrs Assigned:", 687, 176, 86, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$HoursAssmonth = GUICtrlCreateLabel("100/100", 776, 176, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$HoursAssYTD = GUICtrlCreateLabel("100000", 873, 176, 46, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label15 = GUICtrlCreateLabel("Gross Income:", 687, 198, 89, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$GrossMonth = GUICtrlCreateLabel("100", 776, 198, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$GrossYTD = GUICtrlCreateLabel("100000", 873, 198, 46, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label18 = GUICtrlCreateLabel("Expenses:", 687, 221, 66, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$ExpensesMonth = GUICtrlCreateLabel("100", 776, 221, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$ExpensesYTD = GUICtrlCreateLabel("100000", 873, 221, 46, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Label24 = GUICtrlCreateLabel("Net Income:", 687, 244, 74, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$NetIncomeMonth = GUICtrlCreateLabel("100", 776, 244, 90, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$NetIncomeYTD = GUICtrlCreateLabel("100000", 873, 244, 46, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$Projected = GUICtrlCreateLabel("Projected Revenue:  9999999", 739, 273, 186, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group5 = GUICtrlCreateGroup("", 678, 319, 316, 273)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("General", 790, 335, 73, 27, $SS_CENTER)
GUICtrlSetFont(-1, 16, 400, 6, "Times New Roman")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$CasesTab = GUICtrlCreateTabItem("Case Details")
GUICtrlSetState(-1,$GUI_SHOW)
$Group6 = GUICtrlCreateGroup("Consumer Addresses", 16, 247, 268, 261)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label16 = GUICtrlCreateLabel(" Home", 24, 278, 44, 20)
GUICtrlSetFont(-1, 10, 800, 4, "Tahoma")
$CaseHomeStreet = GUICtrlCreateEdit("", 74, 278, 200, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label20 = GUICtrlCreateLabel("City", 27, 307, 24, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseHomeCity = GUICtrlCreateEdit("", 52, 305, 109, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label21 = GUICtrlCreateLabel("State", 179, 308, 32, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseHomeState = GUICtrlCreateEdit("", 211, 306, 34, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label22 = GUICtrlCreateLabel("Zip", 25, 333, 21, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseHomeZip = GUICtrlCreateEdit("", 48, 331, 52, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseHomePhone = GUICtrlCreateEdit("", 147, 330, 126, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseHomeEmail = GUICtrlCreateEdit("", 67, 357, 206, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label23 = GUICtrlCreateLabel("Phone", 108, 332, 40, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label25 = GUICtrlCreateLabel("Email", 28, 358, 36, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label32 = GUICtrlCreateLabel(" Work", 25, 400, 42, 20)
GUICtrlSetFont(-1, 10, 800, 4, "Tahoma")
$CaseWorkStreet = GUICtrlCreateEdit("", 74, 399, 200, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label27 = GUICtrlCreateLabel("City", 27, 428, 24, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseWorkCity = GUICtrlCreateEdit("", 52, 426, 109, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label28 = GUICtrlCreateLabel("State", 179, 429, 32, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseWorkState = GUICtrlCreateEdit("", 211, 427, 34, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseWorkPhone = GUICtrlCreateEdit("", 147, 451, 126, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label29 = GUICtrlCreateLabel("Phone", 108, 453, 40, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseWorkZip = GUICtrlCreateEdit("", 48, 452, 52, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label30 = GUICtrlCreateLabel("Zip", 25, 454, 21, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label31 = GUICtrlCreateLabel("Email", 28, 479, 36, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseWorkEmail = GUICtrlCreateEdit("", 67, 478, 206, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group7 = GUICtrlCreateGroup("Source/Case Information", 16, 87, 879, 156)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$CasePOC = GUICtrlCreateCombo("", 130, 172, 177, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL,$CBS_SORT))
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label33 = GUICtrlCreateLabel("Counselor/POC", 28, 175, 101, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
$Label34 = GUICtrlCreateLabel("Office", 28, 215, 41, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
$CaseOffice = GUICtrlCreateCombo("", 71, 212, 236, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL,$CBS_SORT))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseAddTypeCombo = GUICtrlCreateCombo("", 322, 109, 162, 25)
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label35 = GUICtrlCreateLabel("", 22, 167, 4, 4)
GUICtrlSetFont(-1, 8, 800, 0, "Arial")
$Label36 = GUICtrlCreateLabel("Case Type", 323, 136, 70, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
$CaseRemoveTypeButton = GUICtrlCreateButton("Remove", 437, 136, 47, 18, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$CaseAddTypeButton = GUICtrlCreateButton("Add", 397, 136, 27, 18, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$Label48 = GUICtrlCreateLabel("Authorization Info", 499, 161, 123, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
$CaseAuthorizations = GUICtrlCreateEdit("", 492, 181, 183, 53, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseContacts = GUICtrlCreateEdit("", 685, 181, 202, 53, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label49 = GUICtrlCreateLabel("Contacts", 693, 160, 62, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
$CaseTypeList = GUICtrlCreateList("", 322, 158, 162, 76, BitOR($LBS_SORT,$LBS_NOINTEGRALHEIGHT,$LBS_STANDARD,$WS_VSCROLL,$WS_BORDER))
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseConsumerLastName = GUICtrlCreateEdit("", 92, 136, 113, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label14 = GUICtrlCreateLabel("Last Name", 119, 118, 65, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label17 = GUICtrlCreateLabel("First Name", 229, 117, 65, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseConsumerFirstName = GUICtrlCreateEdit("", 211, 136, 94, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label37 = GUICtrlCreateLabel("Authorized", 519, 107, 76, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
$CaseAuthDate = GUICtrlCreateDate("2006/12/11 23:32:49", 513, 128, 97, 23, $WS_TABSTOP)
$Label38 = GUICtrlCreateLabel("Completed", 635, 107, 72, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
$CaseCompletedCheckbox = GUICtrlCreateCheckbox("", 710, 107, 17, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$CaseCompDate = GUICtrlCreateDate("2006/12/11 23:32:49", 628, 128, 98, 23, $WS_TABSTOP)
$Label39 = GUICtrlCreateLabel("Payment Rec'd", 747, 107, 101, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
$CasePaidCheckbox = GUICtrlCreateCheckbox("", 852, 106, 17, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$CasePayDate = GUICtrlCreateDate("2006/12/11 23:32:49", 745, 127, 122, 23, $WS_TABSTOP)
$Label56 = GUICtrlCreateLabel("Consumer", 22, 137, 68, 20)
GUICtrlSetFont(-1, 10, 800, 0, "Tahoma")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group8 = GUICtrlCreateGroup("Work History", 292, 247, 704, 227)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$CaseWHDate = GUICtrlCreateDate("2006/12/27 23:32:49", 298, 287, 90, 23, $WS_TABSTOP)
$CaseWHWorker = GUICtrlCreateCombo("Jenna", 391, 286, 72, 25)
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseWHTask = GUICtrlCreateEdit("", 611, 285, 376, 23, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseWHHours = GUICtrlCreateCombo("", 550, 286, 57, 25)
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseWHListView = GUICtrlCreateListView("Date|Worker|Cat|Hrs|          Task          ", 299, 320, 615, 145, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$LVS_SORTDESCENDING,$WS_HSCROLL,$WS_VSCROLL))
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseWHAddButton = GUICtrlCreateButton("Add", 933, 335, 42, 19, 0)
GUICtrlSetFont(-1, 8, 400, 0, "Arial")
$CaseWHCateg = GUICtrlCreateCombo("Tech", 467, 286, 80, 25)
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label42 = GUICtrlCreateLabel("Date", 326, 271, 30, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label43 = GUICtrlCreateLabel(" Worker", 401, 271, 46, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label44 = GUICtrlCreateLabel("Categ", 488, 271, 37, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label45 = GUICtrlCreateLabel("Hours", 561, 271, 38, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label46 = GUICtrlCreateLabel("Task", 625, 271, 31, 19)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Date7 = GUICtrlCreateDate("2006/12/11 23:32:49", 1140, 530, 104, 21, $WS_TABSTOP)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group10 = GUICtrlCreateGroup("Invoice Info", 17, 511, 268, 158)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$CaseInvoiceListView = GUICtrlCreateListView("Type|Qty (J/M)|Rate|Amount|Description", 25, 535, 242, 105)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseInvoiceTotalAmount = GUICtrlCreateLabel("Total Invoice:", 77, 647, 162, 19)
GUICtrlSetFont(-1, 9, 800, 0, "Arial")
$CaseTotalInvoice = GUICtrlCreateLabel("Total Invoice:", 60, 823, 186, 20)
GUICtrlSetFont(-1, 10, 800, 4, "Tahoma")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group9 = GUICtrlCreateGroup("Notes", 293, 479, 315, 189)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
$CaseNotes = GUICtrlCreateEdit("", 300, 502, 300, 154, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN,$WS_VSCROLL))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group11 = GUICtrlCreateGroup("Files", 616, 479, 377, 189)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
$CaseFiles = GUICtrlCreateList("", 628, 505, 154, 61, BitOR($LBS_SORT,$LBS_NOINTEGRALHEIGHT,$WS_BORDER))
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group12 = GUICtrlCreateGroup("Rates", 901, 88, 93, 153)
GUICtrlSetFont(-1, 12, 400, 0, "Tahoma")
$Label19 = GUICtrlCreateLabel("Tech", 911, 134, 31, 15)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label26 = GUICtrlCreateLabel("Travel", 907, 161, 36, 15)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$Label40 = GUICtrlCreateLabel("Train", 911, 188, 31, 15)
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseTechRate = GUICtrlCreateEdit("", 947, 132, 37, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseTravelRate = GUICtrlCreateEdit("", 947, 159, 37, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
$CaseTrainRate = GUICtrlCreateEdit("", 947, 186, 38, 20, BitOR($ES_AUTOVSCROLL,$ES_AUTOHSCROLL,$ES_WANTRETURN))
GUICtrlSetData(-1, "")
GUICtrlSetFont(-1, 9, 400, 0, "Arial")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ExpensesTab = GUICtrlCreateTabItem("Expenses")
$PerfTab = GUICtrlCreateTabItem("Performance Data")
GUICtrlCreateTabItem("")
$Label6 = GUICtrlCreateLabel("MJT Manager", 384, 7, 183, 40)
GUICtrlSetFont(-1, 24, 400, 0, "Times New Roman")
$Label13 = GUICtrlCreateLabel("07-Dec-2007", 804, 17, 117, 27)
GUICtrlSetFont(-1, 16, 400, 0, "Times New Roman")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUICtrlSetState($MainTab,$GUI_SHOW)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_EVENTS")

;;;;  Control updates  ;;;;;;;;;;

If Not _FileReadToArray("E:\MJT Manager 2.0\MJTData.txt",$MJTData) Then
    MsgBox(0, "Error", "Unable to open MJTData.txt")
    Exit
EndIf 

Global $Monthbegdate=_DateToDayValue(@YEAR,@MON,1)
Global $YearBegDate=_DateToDayValue(@YEAR,1,1)
_GUICtrlListViewSetColumnWidth($Opencaselist,0,50)
_GUICtrlListViewSetColumnWidth($Opencaselist,2,60)
_GUICtrlListViewSetColumnWidth($Opencaselist,1,177)
_GUICtrlListViewSetColumnWidth($ClosedPaidList,0,50)
_GUICtrlListViewSetColumnWidth($ClosedPaidList,2,60)
_GUICtrlListViewSetColumnWidth($ClosedPaidList,1,173)
GUICtrlSetData($CaseTypeFilter,$MJTData[1],"All")
GUICtrlSetData($Workedbyfilter,$MJTData[2],"Anyone")
GUICtrlSetData($Sourcefilter,$MJTData[3],"All")
GUICtrlSetData($FromDateFilter,@YEAR-1 & "/01/01")
GUICtrlSetData($ToDateFilter,@YEAR & "/" & @MON & "/" & @MDAY)
$tempstr="2001"
For $i=2002 To @YEAR
    $tempstr=$tempstr & "|" & $i
Next
GUICtrlSetData($YearCombo, $tempstr, @YEAR)
_GUICtrlListViewSetColumnWidth($CaseWHListView,0,80)
_GUICtrlListViewSetColumnWidth($CaseWHListView,1,60)
_GUICtrlListViewSetColumnWidth($CaseWHListView,2,40)
_GUICtrlListViewSetColumnWidth($CaseWHListView,3,45)
_GUICtrlListViewSetColumnWidth($CaseWHListView,4,385)
_GUICtrlListViewSetColumnWidth($CaseInvoiceListView,0,50)
_GUICtrlListViewSetColumnWidth($CaseInvoiceListView,1,70)
_GUICtrlListViewSetColumnWidth($CaseInvoiceListView,2,45)
_GUICtrlListViewSetColumnWidth($CaseInvoiceListView,3,68)
_GUICtrlListViewSetColumnWidth($CaseInvoiceListView,4,230)
$COSContext=GUICtrlCreateContextMenu($CaseInvoiceListView)
$COSContextAddCOS=GUICtrlCreateMenuitem("Add COS Item",$COSContext)
$COSContextRemoveCOS=GUICtrlCreateMenuitem("Remove Selected COS Item",$COSContext)
$CasetypeContext=GUICtrlCreateContextMenu($CaseTypeList)
$CasetypeContextAddType=GUICtrlCreateMenuitem("Add Case Type",$CasetypeContext)
$CasetypeContextRemoveType=GUICtrlCreateMenuitem("Remove Selected Case Type",$CasetypeContext)
$CasetypeContextAddToList=GUICtrlCreateMenuitem("Add New Default Case Type",$CasetypeContext)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

LoadMainPage()

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ClosedRadio
            if GUICtrlRead($ClosedRadio)=$GUI_CHECKED Then  
                FileChangeDir("E:\MJT Manager 2.0\Closed Cases\")
                $closedorpaid="closed"
                _GUICtrlListViewDeleteAllItems($ClosedPaidlist)
                ;Populate_ClosedList()
            EndIf
        Case $PaidRadio
            if GUICtrlRead($PaidRadio)=$GUI_CHECKED Then    
                $closedorpaid="paid"
                _GUICtrlListViewDeleteAllItems($ClosedPaidlist)
                $tempdatearray=StringSplit(GUICtrlRead($FromDateFilter),"/")
                If _DateToDayValue($tempdatearray[3],$tempdatearray[1],$tempdatearray[2])<> _DateToDayValue(@YEAR,1,1) Then
                    Populate_MasterPaidList()
                Else
                    FileChangeDir("E:\MJT Manager 2.0\" & @YEAR & "\Paid Cases\")
                    ;Populate_PaidList()
                EndIf
            EndIf
        Case $ApplyFilters
            _GUICtrlListViewDeleteAllItems($ClosedPaidlist)
            _GUICtrlListViewDeleteAllItems($Opencaselist)
            if GUICtrlRead($PaidRadio)=$GUI_CHECKED Then    
                $tempdatearray=StringSplit(GUICtrlRead($FromDateFilter),"/")
                If _DateToDayValue($tempdatearray[3],$tempdatearray[1],$tempdatearray[2])<> _DateToDayValue(@YEAR,1,1) Then
                    Populate_MasterPaidList()
                Else
                    FileChangeDir("E:\MJT Manager 2.0\Closed Cases\")
                    ;Populate_PaidList()
                EndIf
            Else
                FileChangeDir("E:\MJT Manager 2.0\Closed Cases\")
                ;Populate_ClosedList()
            EndIf
            FileChangeDir("E:\MJT Manager 2.0\Open Cases\")
            ;Populate_OpenList()
        Case $YearCombo
            _GUICtrlListViewDeleteAllItems($ClosedPaidlist)
            _GUICtrlListViewDeleteAllItems($Opencaselist)
            LoadMainPage()
        Case $EnterNewCase
            ;ClearCaseDetails()
            GUICtrlSetState($CasesTab,$GUI_SHOW)
        Case $CaseAddTypeButton
        Case Else
    EndSwitch
WEnd

Func WM_Notify_Events($hWndGUI, $MsgID, $wParam, $lParam)
    ;#forceref $hWndGUI, $MsgID
    Local $tagNMHDR, $event
    Local Const $NM_FIRST = 0
    Local Const $NM_CLICK = -2
    Local Const $NM_DBLCLK = -3
    Local Const $NM_RETURN = $NM_FIRST - 4
    Local Const $NM_RCLICK = -5
    Local Const $TCN_FIRST = -550
    Local Const $TCN_SELCHANGING = $TCN_FIRST-2

    Switch $wParam
        Case $ClosedPaidlist            
            $tagNMHDR = DllStructCreate("int;int;int", $lParam);NMHDR (hwndFrom, idFrom, code)
            If @error Then Return
            $event = DllStructGetData($tagNMHDR, 3)
            Switch $event
                Case $NM_DBLCLK
                    $Event_Code = $event
                    ;If $DebugIt Then ConsoleWrite("-->$NM_DBLCLK" & @LF)
                    if GUICtrlRead($PaidRadio)=$GUI_CHECKED Then    
                        $paydate=stringsplit(GuiCtrlRead($CasePayDate),"/")
                        ;LoadCaseDetails("E:\MJT Manager 2.0\" & $paydate[3] & "\Paid Cases\" & _GUICtrlListViewGetItemText($ClosedPaidlist,-1,1) & ".txt")
                    Else
                        ;LoadCaseDetails("E:\MJT Manager 2.0\Closed Cases\" & _GUICtrlListViewGetItemText($ClosedPaidlist,-1,1) & ".txt")
                    EndIf
            EndSwitch
    EndSwitch
$tagNMHDR = 0
EndFunc ;==>WM_Notify_Events 


Func Populate_MasterPaidList()
    Local $counter=0
    $filterok=1
    Dim $paidlist[20000]
    Dim $temparray[7]
    Dim $tempdatearray[3]
    $markpaidamountmonth=0
    $markpaidamountytd=0
    $jennapaidamountmonth=0
    $jennapaidamountytd=0
    $tempdatearray=StringSplit(Guictrlread($FromDateFilter),"/")
    $fromdatenum=_DateToDayValue($tempdatearray[3],$tempdatearray[1],$tempdatearray[2])
    $tempdatearray=StringSplit(Guictrlread($ToDateFilter),"/")
    $todatenum=_DateToDayValue($tempdatearray[3],$tempdatearray[1],$tempdatearray[2])   
    If Not _FileReadToArray("E:\MJT Manager 2.0\masterpaidlist.txt",$paidlist) Then
        MsgBox(0, "Error", "Unable to open masterpaidlist.txt")
    EndIf
    ;Guisetstate($MJTManager,@SW_LOCK)
    ;Guictrlsetstate($ClosedPaidlist,$GUI_HIDE)
    $casetypetext=Guictrlread($CaseTypeFilter)
    $workedbytext=Guictrlread($Workedbyfilter)
    $sourcetext=GUICtrlRead($SourceFilter)
    For $i=1 To 2000
        GUICtrlCreateListViewItem("|Johnson_Maleky|$1870",$ClosedPaidlist)
    Next
    ;Guisetstate($MJTManager,@SW_UNLOCK)
    ;Guictrlsetstate($ClosedPaidlist,$GUI_SHOW)
EndFunc

Func LoadMainPage()
    Global $Monthbegdate=_DateToDayValue(@YEAR,@MON,1)
    Global $YearBegDate=_DateToDayValue(GUICtrlRead($YearCombo),1,1)
    Global $MJTData
    Dim $MJTData    
    If Not _FileReadToArray("E:\MJT Manager 2.0\MJTData.txt",$MJTData) Then
        MsgBox(0, "Error", "Unable to open MJTData.txt")
        Exit
    EndIf 
EndFunc

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

...
    GUISetCursor(15,1)
    Guisetstate(@SW_LOCK,$MJTManager)
    $casetypetext=Guictrlread($CaseTypeFilter)
    $workedbytext=Guictrlread($Workedbyfilter)
    $sourcetext=GUICtrlRead($SourceFilter)
    For $i=1 To 2000
        GUICtrlCreateListViewItem("|Johnson_Maleky|$1870",$ClosedPaidlist)
    Next
    Guisetstate(@SW_UNLOCK,$MJTManager)
    GUISetCursor(2)
...

EDIT: added GUISetCursor()

Edited by Zedna

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

nice work...

maybe replace this line

$Label13 = GUICtrlCreateLabel(_DateTimeFormat( _NowCalc(),1), 700, 20, 260, 27)

it will give you the day and date

... just one idea

*************************************

I noticed you have this

Guisetstate($MJTManager,@SW_LOCK)

per help it is GUISetState ( [flag [, winhandle]] )

so it should look like this

Guisetstate(@SW_LOCK, $MJTManager)

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

some more thoughts

1

Placing a message while updating the ListView

Func Populate_MasterPaidList()
    Local $counter=0
    $filterok=1
    Dim $paidlist[20000]
    Dim $temparray[7]
    Dim $tempdatearray[3]
    $markpaidamountmonth=0
    $markpaidamountytd=0
    $jennapaidamountmonth=0
    $jennapaidamountytd=0
    $tempdatearray=StringSplit(Guictrlread($FromDateFilter),"/")
    $fromdatenum=_DateToDayValue($tempdatearray[3],$tempdatearray[1],$tempdatearray[2])
    $tempdatearray=StringSplit(Guictrlread($ToDateFilter),"/")
    $todatenum=_DateToDayValue($tempdatearray[3],$tempdatearray[1],$tempdatearray[2])   
    If Not _FileReadToArray("E:\MJT Manager 2.0\masterpaidlist.txt",$paidlist) Then
        MsgBox(0, "Error", "Unable to open masterpaidlist.txt")
        ;Return ; un-comment this return
    EndIf
    Guisetstate(@SW_LOCK, $MJTManager)
    ;Guictrlsetstate($ClosedPaidlist,$GUI_HIDE)
    $casetypetext=Guictrlread($CaseTypeFilter)
    $workedbytext=Guictrlread($Workedbyfilter)
    $sourcetext=GUICtrlRead($SourceFilter)
    ToolTip("Updating List, Please Wait... ", 100, 450, "MJT Manager", 1)
    For $i=1 To 2000
        GUICtrlCreateListViewItem("|Johnson_Maleky|$1870",$ClosedPaidlist)
    Next
    Guisetstate(@SW_UNLOCK, $MJTManager)
    ToolTip("")
    ;Guictrlsetstate($ClosedPaidlist,$GUI_SHOW)
EndFunc

oÝ÷ Ûd^iاØ^~)^¶§jºÚɩݦVx-è§~§¶¥Ëoì-+z§vÊ'2¢æ«z·v)ජú-¡·Êek'jëh×6



#include <GUIConstants.au3>

GUICreate("listview items",220,250, 100,200,-1,$WS_EX_ACCEPTFILES)
GUISetBkColor (0x00E0FFFF)  ; will change background color

$listview = GUICtrlCreateListView ("col1  |col2|col3  ",10,10,200,150);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton ("Populate My ListView",40,170,130,20)

GUISetState()

Do
  $msg = GUIGetMsg ()
     
   Select
      Case $msg = $button
         Populate()
     Case Else
         ;
   EndSelect
Until $msg = $GUI_EVENT_CLOSE

Func Populate()
    ; read info from file(?) to an array
    $info = StringSplit("data1|data2|data3,info1|info2|info3,text1|text2|text3", ",")
    
    ; place info into ListView
    For $x = 1 to UBound($info) -1
         GUICtrlCreateListViewItem($info[$x],$listview)
    Next

EndFunc

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

@ mark2004

I think you might have forgotten to remove sorting while you add items. What is the effect ifyou do not have sorting?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

@ mark2004

I think you might have forgotten to remove sorting while you add items. What is the effect ifyou do not have sorting?

I haven't noticed a significant effect from removing the sorting. But, having said that I have also been populating my listview

with dummy items that are all the same. So maybe the sorting is not coming into play yet.

I'm still a bit disappointed with the speed of things. The perplexing part is if I were to take my loop that creates the listview items

and put it into another simpler GUI code, such as the one below, the listview populates almost instantly even without adding all the tricks discussed so far in this post.....WHY??????

This thing has been killing me....I think I need a drink

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


$MyGui = GUICreate("GUI to test listview", 1016, 687, 2, 11)
$ClosedPaidList = GUICtrlCreateListView("Days |Case Name                           |Amount", 24, 334, 303, 325, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS))
$Button1=GUICtrlCreateButton("Populate",20,20,80,20)
GuiSetState()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            Populate_MasterPaidList()
    EndSwitch
WEnd



Func Populate_MasterPaidList()

    For $i=1 To 2000
        GUICtrlCreateListViewItem("|Johnson_Maleky|$1870",$ClosedPaidlist)
    Next

EndFunc

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Ignore this post. The question I was going to ask is irrelevant. I'll be back.

Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

And, I forgot to say THANKS for all the great suggestions for my code. I've incorporated all of them.

Share this post


Link to post
Share on other sites

1.5sec on PII/400 128 MB RAM WIN98 - I think it's OK

Func Populate_MasterPaidList()

;~     GUISetCursor(15,1)
    Guisetstate(@SW_LOCK,$MyGui )
    
    $a = TimerInit()    

    For $i=1 To 2000
        GUICtrlCreateListViewItem("|Johnson_Maleky|$1870",$ClosedPaidlist)
    Next

    $b = TimerDiff($a)  
    ConsoleWrite($B)

    Guisetstate(@SW_UNLOCK,$MyGui )
;~     GUISetCursor(2)
EndFunc

Share this post


Link to post
Share on other sites

And, I forgot to say THANKS for all the great suggestions for my code. I've incorporated all of them.

If I test your script it takes 10 seconds.

If I do this instead

For $i=1 To 2000
        ;GUICtrlCreateListViewItem("|Johnson_Maleky|$1870",$ClosedPaidlist)
    _GUICtrlListViewInsertItem($ClosedPaidlist, -1, "|Johnson_Maleky|$1870")
    Next

it takes 5 seconds. It's still not what you want but it's better. (I also had Guictrlsetstate($ClosedPaidlist,$GUI_HIDE both ways which saves about 2 seconds)


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

1.5sec on PII/400 128 MB RAM WIN98 - I think it's OK

Func Populate_MasterPaidList()

;~     GUISetCursor(15,1)
    Guisetstate(@SW_LOCK,$MyGui )
    
    $a = TimerInit()    

    For $i=1 To 2000
        GUICtrlCreateListViewItem("|Johnson_Maleky|$1870",$ClosedPaidlist)
    Next

    $b = TimerDiff($a)  
    ConsoleWrite($B)

    Guisetstate(@SW_UNLOCK,$MyGui )
;~     GUISetCursor(2)
EndFunc
I tried that and it 8.6 seconds for me. Maybe it's XP- I'm surpised you get that speed if the only difference is you using WIn98 unles it's my CPU which is a Celeron 2.4 GHz and 512Mb Ram Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I tried that and it 8.6 seconds for me. Maybe it's XP- I'm surpised you get that speed if the only difference is you using WIn98 unles it's my CPU which is a Celeron 2.4 GHz and 512Mb Ram

Do you have latest version of AutoIt? In version 3.2.2.0 is done speed improvement (about 100% in some scripts)

Also check for some background processes in WinXP and their CPU consuming - maybe antivirus/firewall or something similar.

Edited by Zedna

Share this post


Link to post
Share on other sites

Do you have latest version of AutoIt? In version 3.2.2.0 is done speed improvement (about 100% in some scripts)

Also check for some background processes in WinXP and their CPU consuming - maybe antivirus/firewall or something similar.

I have tried with version 3.2.2.0 and beta 3.2.1.14 and there is no difference in speed for me. If I look at the Task Manager the System Idle Process is around 98,99%. When I run the script and click on Paid Cases it takes up 99% of the CPU time while its filling the listview so I don't know how you go so fast!

I have also tried compiling and running the exe rather than running from Scite but again no difference.

Incidentally, I notice that you cannot tell the version of Autoit2exe; it just says version 3. This is an omission isn't it?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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