Sign in to follow this  
Followers 0
MouseSpotter

Looking for the fastest way to build a Combobox list

2 posts in this topic

I am adding a large list of data to a combobox dropdown (mainly because I want the list be visible beyond the thin GUI height).

The list is then filtered, based on what the user enters in the edit box (a reducing list).

Rebuilding the dropdown list is causes the list to 'flicker' because it is cleared then re-shown.

_GUICtrlComboBox_BeginUpdate has reduced the flicker a bit - however, I am looking for a way to reduce this further.

Any ideas?

I have looked into the _GUICtrlComboBox & _GUICtrlComboBoxEx options and these are slower  than the GUICtrlSetData options:

#include <GUIConstantsEx.au3>
#include <GuiComboBox.au3>
#include <GuiComboBoxEx.au3>

Local $hGui = GUICreate("")

local $t
local $text = ""
local $y = 0

$t=TimerInit()
local $hCombo_Add = _GUICtrlComboBox_Create($hGui,"",0,$y)
$y += 40
for $i=1 to 4500
    _GUICtrlComboBox_AddString($hCombo_Add,$i)
next
ConsoleWrite("_GUICtrlComboBox_AddString:" & TimerDiff($t)&@crlf)

$t=TimerInit()
$text = ""
for $i=1 to 4500
    $text &= $i & "|"
next
local $hCombo_Create = _GUICtrlComboBox_Create($hGui,$text,0,$y)
$y += 40
ConsoleWrite("_GUICtrlComboBox_Create:" & TimerDiff($t)&@crlf)

$t=TimerInit()
local $hComboEx_Add = _GUICtrlComboBoxEx_Create($hGui,"",0,$y)
$y += 40
for $i=1 to 4500
    _GUICtrlComboBoxEx_AddString($hComboEx_Add,$i)
next
ConsoleWrite("_GUICtrlComboBoxEx_AddString:" & TimerDiff($t)&@crlf)

$t=TimerInit()
$text = ""
for $i=1 to 4500
    $text &= $i & "|"
next
local $hComboEx_Create = _GUICtrlComboBoxEx_Create($hGui,$text,0,$y)
$y += 40
ConsoleWrite("_GUICtrlComboBoxEx_Create:" & TimerDiff($t)&@crlf)

$t=TimerInit()
$text = ""
for $i=1 to 4500
    $text &= $i & "|"
next
GUICtrlCreateCombo("",0,$y)
$y += 40
GUICtrlSetData(-1,$text)
ConsoleWrite("GUICtrlSetData:"&TimerDiff($t)&@crlf)

GUISetState()

 While 1
      If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()

Share this post


Link to post
Share on other sites



Have a look at GUICtrlSetData to update the ComboBox with a single call.

_GUI* (UDF) functions are slower than GUI* functions because the UDF functions are implemented in pure AutoIt whereas the GUI* functions are written in C++.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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