Jump to content

How to accelerate ListView creation?


Recommended Posts

Hi,

Sorry for my english...

It's my code:

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

$GUI = GUICreate("Listview", 300,300)
$hListView = GuiCtrlCreateListView("1|2|3|4|5|6|7", 10, 10, 280, 290,-1, BitOR($LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT ))

$x = 100

For $i = 0 to $x
    GUICtrlCreateListViewItem("1|2|3|4|5|6|7", $hListView)
Next

GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
    Sleep(10)
WEnd

If $x small then all work fast, but if $x > 1000 then the window is created too long.

In my program I need use $x = 50000. Time of window creation = 1 min. It's VERY long.

How I can accelerate process of window creation?

Link to comment
Share on other sites

You could use the GuiListView UDF. Function _GUICtrlListView_AddArray adds items from an array to the control

See User Defined Functions -> GuiListView Management in the help file.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I've used version of this for listviews with > 100,000 rows

Thanks!!! It's realy fast!!!

But how I can use the given code for my creation ListView?

Code very long and difficult. Probably exists UDF on ListView with use of the given code?

Link to comment
Share on other sites

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

$GUI = GUICreate("Listview", 300,300)
$hListView = GuiCtrlCreateListView("1|2|3|4|5|6|7", 10, 10, 280, 290,-1, BitOR($LVS_EX_GRIDLINES,$LVS_EX_FULLROWSELECT ))

$x = 100000
_GUICtrlListView_BeginUpdate($hListView)
For $i = 0 to $x
    GUICtrlCreateListViewItem("1|2|3|4|5|6|7", $hListView)
Next
_GUICtrlListView_EndUpdate($hListView)
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        Exit
    EndIf
    Sleep(10)
WEnd

added :

1. _GUICtrlListView_BeginUpdate($hListView)

2. _GUICtrlListView_EndUpdate($hListView)

Edited by psandu.ro
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...