Die schnelligkeit von GUICtrlSetData

  • Moin moin,

    also zu erklärung, ich habe ein relativ großes script das ähnlich wie eine Exeltabelle aufgebaut ist also mit zeilen und spalten, jede Zelle ist ein Input bzw. eine Combobox, so am anfang hatte ich nur inputs wenn man da eine Datei geöffnet hatte ging das alles relativ schnell. Seitdem ich ein paar Spalten als Combobox gemacht habe dauert das oeffnen einer datei 3-4 sekunden länger, liegt das einfach an dem größeren String? Denn bei der Combobox kommen ja z.B. alle Namen aus der Datenbank rein und nur der Name der dann stehen soll kommt halt als default... kennt man ja :)
    Beim öffnen des Programmes habe ich die ganze sache schon optimiert... :) :
    Will da jetzt nicht den ganzen Code reinmachen aber kurz, ich habe mir den WM_Command zu nutze gemacht mit CBS_DROPDOWN d.h. jedes mal wenn dieses "signal" eines Dropdowns kommt wird die Entsprechende ComboBox gefüllt, da das aber bei dem öffnen einer datei nicht funktioniert ist wohl klar, also meine Frage an euch: Habe ich irgendwelche Alternativen um das ganze auf Geschwindigkeit zu optimieren?

    THX 4 all help :D

    MFG FireFlyer

    *Paradox ist, wenn man sich im Handumdrehen den Fuss bricht* :D

  • Hier einfach mal das Beispiel aus dem AutoComplete
    Ich hab das genauso (naja natürlich ohne die unnötigen sachen wie debugprint usw^^) mit gaaaanz vielen comboboxen, was ja keinen unterschied macht da der WM_COMMAND ja immer gleich ist :)

    Spoiler anzeigen
    [autoit]

    #include <GUIComboBox.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt('MustDeclareVars', 1)

    [/autoit] [autoit][/autoit] [autoit]

    $Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

    [/autoit] [autoit][/autoit] [autoit]

    Global $hCombo

    [/autoit] [autoit][/autoit] [autoit]

    Example_Internal()
    Example_External()

    [/autoit] [autoit][/autoit] [autoit]

    Func Example_Internal()
    Local $hGUI

    [/autoit] [autoit][/autoit] [autoit]

    ; Create GUI
    $hGUI = GUICreate("(Internal) ComboBox Auto Complete", 400, 296)
    $hCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    ; Add files
    _GUICtrlComboBox_BeginUpdate ($hCombo)
    _GUICtrlComboBox_AddDir ($hCombo, @WindowsDir & "\*.exe")
    _GUICtrlComboBox_EndUpdate ($hCombo)

    [/autoit] [autoit][/autoit] [autoit]

    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

    [/autoit] [autoit][/autoit] [autoit]

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
    EndFunc ;==>Example_Internal

    [/autoit] [autoit][/autoit] [autoit]

    Func _Edit_Changed()
    _GUICtrlComboBox_AutoComplete ($hCombo)
    EndFunc ;==>_Edit_Changed

    [/autoit] [autoit][/autoit] [autoit]

    Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hWndFrom, $iIDFrom, $iCode, $hWndCombo
    If Not IsHWnd($hCombo) Then $hWndCombo = GUICtrlGetHandle($hCombo)
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word
    Switch $hWndFrom
    Case $hCombo, $hWndCombo
    Switch $iCode
    Case $CBN_CLOSEUP ; Sent when the list box of a combo box has been closed
    _DebugPrint("$CBN_CLOSEUP" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_DBLCLK ; Sent when the user double-clicks a string in the list box of a combo box
    _DebugPrint("$CBN_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_DROPDOWN ; Sent when the list box of a combo box is about to be made visible
    GUICtrlSetData($hCombo, "|TEST")
    _DebugPrint("$CBN_DROPDOWN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box
    _DebugPrint("$CBN_EDITCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    _Edit_Changed()
    ; no return value
    Case $CBN_EDITUPDATE ; Sent when the edit control portion of a combo box is about to display altered text
    _DebugPrint("$CBN_EDITUPDATE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_ERRSPACE ; Sent when a combo box cannot allocate enough memory to meet a specific request
    _DebugPrint("$CBN_ERRSPACE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_KILLFOCUS ; Sent when a combo box loses the keyboard focus
    _DebugPrint("$CBN_KILLFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_SELCHANGE ; Sent when the user changes the current selection in the list box of a combo box
    _DebugPrint("$CBN_SELCHANGE" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_SELENDCANCEL ; Sent when the user selects an item, but then selects another control or closes the dialog box
    _DebugPrint("$CBN_SELENDCANCEL" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_SELENDOK ; Sent when the user selects a list item, or selects an item and then closes the list
    _DebugPrint("$CBN_SELENDOK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    Case $CBN_SETFOCUS ; Sent when a combo box receives the keyboard focus
    _DebugPrint("$CBN_SETFOCUS" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _
    "-->IDFrom:" & @TAB & $iIDFrom & @LF & _
    "-->Code:" & @TAB & $iCode)
    ; no return value
    EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_COMMAND

    [/autoit] [autoit][/autoit] [autoit]

    Func _DebugPrint($s_text, $line = @ScriptLineNumber)
    ConsoleWrite( _
    "!===========================================================" & @LF & _
    "+======================================================" & @LF & _
    "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _
    "+======================================================" & @LF)
    EndFunc ;==>_DebugPrint

    [/autoit]

    MFG FireFlyer

    *Paradox ist, wenn man sich im Handumdrehen den Fuss bricht* :D

  • Hier mal ein winziger ausschnitt gekürzt von meiner Datei öffnen funktion

    Spoiler anzeigen
    [autoit]

    For $b = 1 To $max_starts ;(kann max. 200 sein)
    ;Hier lädt er verschiedene Daten aus datenbanken und durchsucht die Datei die zu öffnen ist
    If $open_line <> 1 And $open_line <> 2 Then
    $lineelse_read_array = StringSplit($file_read_array[$open_line], ";")
    GUICtrlSetData($array_inputs[$open_line-2][0], $lineelse_read_array[2],$lineelse_read_array[2]) ;Combobox
    GUICtrlSetData($array_inputs[$open_line-2][1], $lineelse_read_array[3])
    ;GUICtrlSetData($array_inputs[$open_line-2][2], $lineelse_read_array[4])
    GUICtrlSetData($array_inputs[$open_line-2][2], $lineelse_read_array[4],$lineelse_read_array[4]) ;Combobox
    ;GUICtrlSetData($array_inputs[$open_line-2][3], $lineelse_read_array[5])
    GUICtrlSetData($array_inputs[$open_line-2][3], $lineelse_read_array[5],$lineelse_read_array[5]) ;Combobox
    GUICtrlSetData($array_inputs[$open_line-2][4], $lineelse_read_array[6])
    GUICtrlSetData($array_inputs[$open_line-2][5], $lineelse_read_array[7])
    GUICtrlSetData($array_inputs[$open_line-2][6], $lineelse_read_array[8])
    $split_start = StringSplit($lineelse_read_array[9], ":")
    GUICtrlSetData($array_inputs[$open_line-2][7], $split_start[1])
    GUICtrlSetData($array_inputs[$open_line-2][8], $split_start[2])
    $split_land = StringSplit($lineelse_read_array[10], ":")
    GUICtrlSetData($array_inputs[$open_line-2][9], $split_land[1])
    GUICtrlSetData($array_inputs[$open_line-2][10], $split_land[2])
    $split_flug = StringSplit($lineelse_read_array[11], ":")
    GUICtrlSetData($array_inputs[$open_line-2][11], $split_flug[1])
    GUICtrlSetData($array_inputs[$open_line-2][12], $split_flug[2])
    GUICtrlSetData($array_inputs[$open_line-2][13], $lineelse_read_array[12])
    EndIf
    ;noch ein paar sachen
    Next

    [/autoit]


    So seitdem ich die 2 unteren Inputs durch Comboboxen ersetzt habe dauert das ganze sehr viel länger ;)

    MFG FireFlyer

    *Paradox ist, wenn man sich im Handumdrehen den Fuss bricht* :D

  • Sry Xeno musste heute morgen leider schnell gehen,

    Nein also das Initialbefüllen dauert relativ lange, ich vermute halt das es einfach an der Datenmenge d.h. dem viel längeren String liegt...

    Ein lauffähiges Script zu posten wird kaum möglich sein da es auf verschiedene Datenbanken usw zurückgreift. Das Problem ist jedoch ganz einfach nimm einmal 100 Inputboxen und befülle die und Messe die Zeit dann Nimm 100 Comboboxen die du mit einem String befüllst und dann mit dem Defaultwert das anzeigen lässt was normalerweise direkt in der Inputbox stünde ;). Das dauert bei mir halt auf jeden fall länger aber ich schätze mal da werd ich net viel optimieren können...

    MFG FireFlyer

    *Paradox ist, wenn man sich im Handumdrehen den Fuss bricht* :D