IntelliBox in mein Programm integrieren

  • Ich habe versucht in mein Programm IntelliSense von BugFix einzufügen.
    Meine Probleme:
    Die Listbox erscheint zwar, aber 1. an einer völlig falschen Stelle. 2. Kann ich die gefundenen Länder nicht anwählen 3. geht die Listbox nicht mehr weg wenn sie einmal offen ist.
    Im Grunde ist es nur dieser Teil der Probleme macht:

    [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    _ChooseBox()
    Case Guigetmsg() = $Gui_Event_Close
    Case $GUI_EVENT_CLOSE
    Exit

    [/autoit]

    Danke für eure Hilfe

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include<GUIConstantsEx.au3>
    #include<ListBoxConstants.au3>
    #include <WindowsConstants.au3>
    #include <GUIListBox.au3>
    #Include <WinAPI.au3>
    #include <Misc.au3>
    Opt("GUICloseOnESC", 0)

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

    #Region ### START Koda GUI section ### Form=

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

    ;$guiBox = GUICreate('', 8, 40, 201, 21, BitOR($WS_SIZEBOX, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    ;######################################################
    ; NEU!
    Global $show = False
    Global $indexB = -1
    Global $SenseGui, $SenseCtrl, $guiBox, $box
    Global $POSSenseGui[2]
    Global $aData[34] = ["Österreich","Australien","Belgien","Bosnien","Brasilien","Kanada","Schweiz","Tschechien","Deutschland","Dänemark","Spanien","Frankreich","Großbritannien","Griechenland","Ungarn","Kroatien","Italien","Irland","Mexico","Malta","Malaysia","Norwegen","Nigeria","Niederlande","Polen","Russland","Schweden","Slowakei","Slowenien","Türkei","England","Amerika","Venezuela","Südafrika"]
    $guiBox = GUICreate('', 180, 100, 300, 100, BitOR($WS_SIZEBOX, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    $box = _GUICtrlListBox_Create($guiBox, '', 0, 0, 150, 86, BitOR($LBS_SORT, 0x00B00002))
    ; ListBox muß 1 Pixel höher als GUI sein - sonst fehlerhafte Darstellung
    For $i = 0 To UBound($aData) -1 ; falls Daten mit _FileReadToArray gelesen werden: StartIndex=1
    _GUICtrlListBox_AddString($box, $aData[$i])
    Next
    #EndRegion Box
    GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
    GUIRegisterMsg($WM_MOVE, "_WM_MOVE")
    GUIRegisterMsg(0x231, "_WM_ENTERSIZEMOVE")
    #EndRegion - Deklarationen Sense

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

    #Region Main
    $Form1 = GUICreate("Tarifsuchmaschine", 506, 125, 2608, 362)
    $SenseGui = $Form1 ; <== Für Allgemeingültigkeit Zuweisung an $SenseGui
    $name = GUICtrlCreateInput("Bitte Land eingeben...", 8, 40, 201, 21)
    $button1 = GUICtrlCreateButton("Such!", 8, 64, 201, 33)
    $label1 = GUICtrlCreateLabel("Bitte Land eingeben", 8, 16, 204, 17)
    $label2 = GUICtrlCreateLabel("", 232, 32, 164, 89)
    $Pic1 = GUICtrlCreatePic("", 400, 8, 73, 57)
    $us = GUICtrlCreateLabel("Deine Suche: ", 232, 8, 164, 17)
    $SenseCtrl = $name ; <== Für Allgemeingültigkeit Zuweisung an $SenseCtrl
    $hInput = GUICtrlGetHandle($name)

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

    $box = _GUICtrlListBox_Create($guiBox, '', 0, 0, 150, 86, BitOR($LBS_SORT, 0x00B00002))
    ; ListBox muß 1 Pixel höher als GUI sein - sonst fehlerhafte Darstellung
    For $i = 0 To UBound($aData) -1 ; falls Daten mit _FileReadToArray gelesen werden: StartIndex=1
    _GUICtrlListBox_AddString($box, $aData[$i])
    Next

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

    GUISetState()
    #EndRegion Main

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

    #region - SenseFuncs
    Func _ChooseBox()
    If Not $show Or ControlGetText($SenseGui, '', $SenseCtrl) = "" Then
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    Return
    EndIf
    If _IsPressed('0D') Then ; ENTER
    If _GUICtrlListBox_GetText($box, $indexB) <> 0 Then
    ControlSetText($SenseGui, '', $SenseCtrl, _GUICtrlListBox_GetText($box, $indexB))
    EndIf
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    ElseIf _IsPressed('1B') Then ; ESC
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    ElseIf _IsPressed('26') Then ; UP
    If $indexB > 0 Then
    $indexB -= 1
    _GUICtrlListBox_SetCurSel($box, $indexB)
    Sleep(90)
    EndIf
    ElseIf _IsPressed('28') Then ; DOWN
    If $indexB < _GUICtrlListBox_GetCount($box)-1 Then
    $indexB += 1
    _GUICtrlListBox_SetCurSel($box, $indexB)
    Sleep(90)
    EndIf
    EndIf
    EndFunc

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

    Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam, 16)
    Local $hCtrl = $lParam
    Local $hSenseCtrl = $SenseCtrl
    If Not IsHWnd($hSenseCtrl) Then $hSenseCtrl = GUICtrlGetHandle($hSenseCtrl)
    If ($nNotifyCode = 1024 Or $nNotifyCode = 6) And $hCtrl = $hSenseCtrl Then
    Local $str = ControlGetText($SenseGui, '', $SenseCtrl)
    $indexB = _GUICtrlListBox_FindString($box, $str)
    _GUICtrlListBox_SetCurSel($box, $indexB)
    $caret = _CaretPos()
    If Not @error And Not $show Then
    If $caret[3] + $caret[4] - 95 < 0 Then ; Platz für Liste über dem Ctrl ausreichend?
    WinMove($guiBox, '', $caret[0], $caret[1] +25) ; Versatz 25 (Ctrlhöhe+5) unter y vom Ctrl
    Else
    WinMove($guiBox, '', $caret[0], $caret[1] -95) ; Versatz 95 (Boxhöhe+10) über y vom Ctrl
    EndIf
    GUISetState(@SW_SHOWNOACTIVATE, $guiBox)
    $show = True
    EndIf
    ElseIf $hCtrl = $box And $nNotifyCode = 1 Then
    $indexB = _GUICtrlListBox_GetCurSel($box)
    ControlSetText($SenseGui, '', $SenseCtrl, _GUICtrlListBox_GetText($box, $indexB))
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    ElseIf $show And $nNotifyCode = 512 And $hCtrl = $lParam And Not $hCtrl = $box Then
    GUISetState(@SW_HIDE,$guiBox)
    $show = False
    EndIf
    Return $GUI_RUNDEFMSG
    EndFunc

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

    Func _WM_ENTERSIZEMOVE($hWnd)
    If $hWnd = $SenseGui Then $POSSenseGui = WinGetPos($SenseGui)
    EndFunc

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

    Func _WM_MOVE($hWnd)
    If $hWnd = $SenseGui Then
    Local $pos = WinGetPos($guiBox)
    Local $postemp = WinGetPos($SenseGui)
    WinMove($guiBox,"",$pos[0]-($POSSenseGui[0]-$postemp[0]),$pos[1]-($POSSenseGui[1]-$postemp[1]))
    $POSSenseGui = WinGetPos($SenseGui)
    EndIf
    EndFunc

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

    Func _CaretPos()
    Local $old = Opt("CaretCoordMode", 0) ;relative mode
    Local $c = WinGetCaretPos() ;relative caret coords
    Local $w = WinGetPos("") ;window's coords
    Local $f = ControlGetFocus("","") ;text region "handle"
    Local $e = ControlGetPos("", "", $f) ;text region coords
    Local $h = ControlGetHandle("", "", $f) ;Ctrl-Handle
    Local $t[5]
    If IsArray($c) and IsArray($w) and IsArray($e) Then
    If _WinAPI_IsClassName($SenseCtrl, 'Edit') Then ; Input wird als Edit-Class erkannt
    $t[0] = $c[0] + $w[0] + $e[0]
    ElseIf _WinAPI_IsClassName($SenseCtrl, 'ComboBox') Then
    $t[0] = $w[0] + $e[0]
    EndIf
    $t[1] = $c[1] + $w[1] + $e[1]
    $t[2] = $h
    $t[3] = $w[1]
    $t[4] = $e[1]
    Opt("CaretCoordMode", $old)
    Return $t ;absolute screen coords of caret cursor
    Else
    Opt("CaretCoordMode", $old)
    SetError(1)
    EndIf
    EndFunc
    #endregion - SenseFuncs
    ;######################################################

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

    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    $var1="0"
    $Internet="0"
    $aufbau="0"
    $an="0"
    $ab="0"
    $inet="0"
    $sms = "0"
    $zahl = "0"
    $land= "0"

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

    ;While True
    ;$nMsg = GUIGetMsg()
    ; Switch $nMsg
    ; Case $GUI_EVENT_CLOSE
    ; _ChooseBox()
    ;If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    _ChooseBox()
    Case Guigetmsg() = $Gui_Event_Close
    Case $GUI_EVENT_CLOSE
    Exit

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

    ;While True
    ;_ChooseBox()
    ;If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
    ;WEnd

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

    ;While 1
    ; $nMsg = GUIGetMsg()
    ; Switch $nMsg
    ; Case $GUI_EVENT_CLOSE
    ;Exit

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


    Case $button1
    consolewrite($name)
    _lauf()
    _bilder()

    EndSwitch


    WEnd
    Func _lauf()

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

    _abkurz()
    If $zahl = "0" Then
    $zahl = IniRead("list.ini", "liste", GUICtrlRead($name),"false")
    $land = GuiCtrlRead($name)

    _suchen()
    _suchen2()
    If IniRead("list.ini", "internet", GUICtrlRead($name),"false") = "False" Then
    consolewrite(" Failed!")
    _ausgabe2()
    Elseif 1 then
    _ausgabe()
    Endif
    Else
    _suchen3()
    _suchen4()
    If IniRead("list.ini", "liste", $zahl,"false") = "False" Then
    consolewrite(" Failed!")
    _ausgabe2()
    Elseif 1 then
    _ausgabe()
    Endif
    EndIf
    EndFunc

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

    Func _suchen()
    $aufbau = IniRead("list.ini","tarif"&$zahl,"aufbau","fehlt")
    $an = IniRead("list.ini","tarif"&$zahl,"an","fehlt")
    $ab = IniRead("list.ini","tarif"&$zahl,"ab","fehlt")
    $sms = IniRead("list.ini","tarif"&$zahl,"sms","fehlt")
    consolewrite("suchen1 tarif"&$zahl&" ")
    EndFunc

    Func _suchen2()
    $zahl = IniRead("list.ini", "internet", GUICtrlRead($name),"false")
    $inet = IniRead("list.ini","inettar"&$zahl,"kosten","fehlt")

    consolewrite("suchen2 inettar"&$zahl&" ")
    endfunc

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

    Func _suchen3()
    $tar2 = IniRead("list.ini","liste",$zahl,"fehlt")
    $aufbau = IniRead("list.ini","tarif"&$tar2,"aufbau","fehlt")
    $an = IniRead("list.ini","tarif"&$tar2,"an","fehlt")
    $ab = IniRead("list.ini","tarif"&$tar2,"ab","fehlt")
    $sms = IniRead("list.ini","tarif"&$tar2,"sms","fehlt")
    consolewrite("suchen3 tarif"&$tar2&" ")
    EndFunc

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

    Func _suchen4()

    $tar = IniRead("list.ini","internet",$zahl,"fehlt")
    $land = $zahl
    $inet = IniRead("list.ini","inettar"&$tar,"kosten","fehlt")
    consolewrite("suchen4 inettar"&$tar&" ")

    endfunc

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

    func _bilder()
    GUICtrlSetImage($pic1,"")
    GUICtrlSetImage($pic1,@WorkingDir&"\"&$land&".gif")
    EndFunc

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

    Func _abkurz()
    If IniRead("list.ini", "abkurz", GUICtrlRead($name),"false") <> "false" Then
    $zahl = iniRead("list.ini","abkurz", GUICtrlRead($name),"false")
    Else
    $zahl = "0"
    Endif
    EndFunc

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

    Func _ausgabe()
    GuiCtrlSetData($label2,"Fixkosten:" & @TAB &$aufbau & "€" & @CRLF & "Ankommend:" &@TAB& $an & "€ / Minute" & @CRLF & "Abgehend:" &@TAB& $ab& "€ / Minute" & @CRLF& "SMS:" & @TAB &@TAB& $sms & "€"& @CRLF & "Daten:"&@TAB&@TAB& $inet & "€ /50kb")
    GuiCtrlSetData($us,"Deine Suche: "&$land)

    Consolewrite(" Deine Suche:"&$land)
    endfunc
    Func _ausgabe2()
    GuiCtrlSetData($label2,"Land nicht gefunden!"& @CRLF & "Bitte Eingabe überprüfen")
    EndFunc

    [/autoit]

    3 Mal editiert, zuletzt von Q-Connect (19. Oktober 2012 um 14:14)

    • Offizieller Beitrag

    Was ich auf den ersten Blick an Fehlern gesehen habe, habe ich entfernt. (doppelte Deklarationen etc.)
    Es funktioniert soweit, aber Auswahl mit Enter ist grad nicht möglich, hab jetzt nicht weiter gesucht warum. Gucke selbst mal.
    Auch die Liste erscheint kleiner als angegeben. Ich arbeite selten mit dem Listbox-Ctrl, kann mich aber schwach erinnern, dass bei bestimmten Werten eine fehlerhafte Darstellung erfolgt. Allerdings kannte ich das bisher nur im Zusammenhang mit Win2K.

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ListBoxConstants.au3>
    #include <WindowsConstants.au3>
    #include <GUIListBox.au3>
    #Include <WinAPI.au3>
    #include <Misc.au3>
    Opt("GUICloseOnESC", 0)

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

    #Region ### START Koda GUI section ### Form=

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

    Global $show = False
    Global $indexB = -1
    Global $SenseGui, $SenseCtrl, $guiBox, $box
    Global $POSSenseGui[2]
    Global $aData[34] = ["Österreich","Australien","Belgien","Bosnien","Brasilien","Kanada","Schweiz","Tschechien","Deutschland","Dänemark","Spanien","Frankreich","Großbritannien","Griechenland","Ungarn","Kroatien","Italien","Irland","Mexico","Malta","Malaysia","Norwegen","Nigeria","Niederlande","Polen","Russland","Schweden","Slowakei","Slowenien","Türkei","England","Amerika","Venezuela","Südafrika"]
    $guiBox = GUICreate('', 180, 100, 300, 100, BitOR($WS_SIZEBOX, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    $box = _GUICtrlListBox_Create($guiBox, '', 0, 0, 180, 101, BitOR($LBS_SORT, 0x00B00002))
    ; ListBox muß 1 Pixel höher als GUI sein - sonst fehlerhafte Darstellung <<<<<<<<<<<<<<<< BEACHTEN !!!!!! >>>>>>>>>>>>>>>>>>>>>>>>>>
    For $i = 0 To UBound($aData) -1 ; falls Daten mit _FileReadToArray gelesen werden: StartIndex=1
    _GUICtrlListBox_AddString($box, $aData[$i])
    Next
    #EndRegion Box
    GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
    GUIRegisterMsg($WM_MOVE, "_WM_MOVE")
    GUIRegisterMsg(0x231, "_WM_ENTERSIZEMOVE")
    #EndRegion - Deklarationen Sense

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

    #Region Main
    ;~ $Form1 = GUICreate("Tarifsuchmaschine", 506, 125, 2608, 362)
    $Form1 = GUICreate("Tarifsuchmaschine", 506, 125, 608, 362)
    $SenseGui = $Form1 ; <== Für Allgemeingültigkeit Zuweisung an $SenseGui
    $name = GUICtrlCreateInput("Bitte Land eingeben...", 8, 40, 201, 21)
    $button1 = GUICtrlCreateButton("Such!", 8, 64, 201, 33)
    $label1 = GUICtrlCreateLabel("Bitte Land eingeben", 8, 16, 204, 17)
    $label2 = GUICtrlCreateLabel("", 232, 32, 164, 89)
    $Pic1 = GUICtrlCreatePic("", 400, 8, 73, 57)
    $us = GUICtrlCreateLabel("Deine Suche: ", 232, 8, 164, 17)
    $SenseCtrl = $name ; <== Für Allgemeingültigkeit Zuweisung an $SenseCtrl
    $hInput = GUICtrlGetHandle($name)

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

    GUISetState()
    #EndRegion Main

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

    $var1="0"
    $Internet="0"
    $aufbau="0"
    $an="0"
    $ab="0"
    $inet="0"
    $sms = "0"
    $zahl = "0"
    $land= "0"

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

    While 1
    _ChooseBox()
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    Case $button1
    consolewrite($name)
    _lauf()
    _bilder()
    EndSwitch
    WEnd

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

    Func _lauf()

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

    _abkurz()
    If $zahl = "0" Then
    $zahl = IniRead("list.ini", "liste", GUICtrlRead($name),"false")
    $land = GuiCtrlRead($name)

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

    _suchen()
    _suchen2()
    If IniRead("list.ini", "internet", GUICtrlRead($name),"false") = "False" Then
    consolewrite(" Failed!")
    _ausgabe2()
    Elseif 1 then
    _ausgabe()
    Endif
    Else
    _suchen3()
    _suchen4()
    If IniRead("list.ini", "liste", $zahl,"false") = "False" Then
    consolewrite(" Failed!")
    _ausgabe2()
    Elseif 1 then
    _ausgabe()
    Endif
    EndIf
    EndFunc

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

    Func _suchen()
    $aufbau = IniRead("list.ini","tarif"&$zahl,"aufbau","fehlt")
    $an = IniRead("list.ini","tarif"&$zahl,"an","fehlt")
    $ab = IniRead("list.ini","tarif"&$zahl,"ab","fehlt")
    $sms = IniRead("list.ini","tarif"&$zahl,"sms","fehlt")
    consolewrite("suchen1 tarif"&$zahl&" ")
    EndFunc

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

    Func _suchen2()
    $zahl = IniRead("list.ini", "internet", GUICtrlRead($name),"false")
    $inet = IniRead("list.ini","inettar"&$zahl,"kosten","fehlt")

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

    consolewrite("suchen2 inettar"&$zahl&" ")
    endfunc

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

    Func _suchen3()
    $tar2 = IniRead("list.ini","liste",$zahl,"fehlt")
    $aufbau = IniRead("list.ini","tarif"&$tar2,"aufbau","fehlt")
    $an = IniRead("list.ini","tarif"&$tar2,"an","fehlt")
    $ab = IniRead("list.ini","tarif"&$tar2,"ab","fehlt")
    $sms = IniRead("list.ini","tarif"&$tar2,"sms","fehlt")
    consolewrite("suchen3 tarif"&$tar2&" ")
    EndFunc

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

    Func _suchen4()

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

    $tar = IniRead("list.ini","internet",$zahl,"fehlt")
    $land = $zahl
    $inet = IniRead("list.ini","inettar"&$tar,"kosten","fehlt")
    consolewrite("suchen4 inettar"&$tar&" ")

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

    endfunc

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

    func _bilder()
    GUICtrlSetImage($pic1,"")
    GUICtrlSetImage($pic1,@WorkingDir&"\"&$land&".gif")
    EndFunc

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

    Func _abkurz()
    If IniRead("list.ini", "abkurz", GUICtrlRead($name),"false") <> "false" Then
    $zahl = iniRead("list.ini","abkurz", GUICtrlRead($name),"false")
    Else
    $zahl = "0"
    Endif
    EndFunc

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

    Func _ausgabe()
    GuiCtrlSetData($label2,"Fixkosten:" & @TAB &$aufbau & "€" & @CRLF & "Ankommend:" &@TAB& $an & "€ / Minute" & @CRLF & "Abgehend:" &@TAB& $ab& "€ / Minute" & @CRLF& "SMS:" & @TAB &@TAB& $sms & "€"& @CRLF & "Daten:"&@TAB&@TAB& $inet & "€ /50kb")
    GuiCtrlSetData($us,"Deine Suche: "&$land)

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

    Consolewrite(" Deine Suche:"&$land)
    endfunc
    Func _ausgabe2()
    GuiCtrlSetData($label2,"Land nicht gefunden!"& @CRLF & "Bitte Eingabe überprüfen")
    EndFunc

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

    #region - SenseFuncs
    Func _ChooseBox()
    If Not $show Then Return
    ;~ If Not $show Or ControlGetText($SenseGui, '', $SenseCtrl) = "" Then
    ;~ GUISetState(@SW_HIDE, $guiBox)
    ;~ $show = False
    ;~ Return
    ;~ EndIf
    If _IsPressed('0D') Then ; ENTER
    If _GUICtrlListBox_GetText($box, $indexB) <> 0 Then
    ControlSetText($SenseGui, '', $SenseCtrl, _GUICtrlListBox_GetText($box, $indexB))
    EndIf
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    ElseIf _IsPressed('1B') Then ; ESC
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    ElseIf _IsPressed('26') Then ; UP
    If $indexB > 0 Then
    $indexB -= 1
    _GUICtrlListBox_SetCurSel($box, $indexB)
    Sleep(90)
    EndIf
    ElseIf _IsPressed('28') Then ; DOWN
    If $indexB < _GUICtrlListBox_GetCount($box)-1 Then
    $indexB += 1
    _GUICtrlListBox_SetCurSel($box, $indexB)
    Sleep(90)
    EndIf
    EndIf
    EndFunc

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

    Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $nNotifyCode = BitShift($wParam, 16)
    Local $hCtrl = $lParam
    Local $hSenseCtrl = $SenseCtrl
    If Not IsHWnd($hSenseCtrl) Then $hSenseCtrl = GUICtrlGetHandle($hSenseCtrl)
    If ($nNotifyCode = 1024 Or $nNotifyCode = 6) And $hCtrl = $hSenseCtrl Then
    Local $str = ControlGetText($SenseGui, '', $SenseCtrl)
    $indexB = _GUICtrlListBox_FindString($box, $str)
    _GUICtrlListBox_SetCurSel($box, $indexB)
    $caret = _CaretPos()
    If Not @error And Not $show Then
    If $caret[3] + $caret[4] - 95 < 0 Then ; Platz für Liste über dem Ctrl ausreichend?
    WinMove($guiBox, '', $caret[0], $caret[1] +25) ; Versatz 25 (Ctrlhöhe+5) unter y vom Ctrl
    Else
    WinMove($guiBox, '', $caret[0], $caret[1] -95) ; Versatz 95 (Boxhöhe+10) über y vom Ctrl
    EndIf
    GUISetState(@SW_SHOWNOACTIVATE, $guiBox)
    $show = True
    EndIf
    ElseIf $hCtrl = $box And $nNotifyCode = 1 Then
    $indexB = _GUICtrlListBox_GetCurSel($box)
    ControlSetText($SenseGui, '', $SenseCtrl, _GUICtrlListBox_GetText($box, $indexB))
    GUISetState(@SW_HIDE, $guiBox)
    $show = False
    ElseIf $show And $nNotifyCode = 512 And $hCtrl = $lParam And Not $hCtrl = $box Then
    GUISetState(@SW_HIDE,$guiBox)
    $show = False
    EndIf
    Return $GUI_RUNDEFMSG
    EndFunc

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

    Func _WM_ENTERSIZEMOVE($hWnd)
    If $hWnd = $SenseGui Then $POSSenseGui = WinGetPos($SenseGui)
    EndFunc

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

    Func _WM_MOVE($hWnd)
    If $hWnd = $SenseGui Then
    Local $pos = WinGetPos($guiBox)
    Local $postemp = WinGetPos($SenseGui)
    WinMove($guiBox,"",$pos[0]-($POSSenseGui[0]-$postemp[0]),$pos[1]-($POSSenseGui[1]-$postemp[1]))
    $POSSenseGui = WinGetPos($SenseGui)
    EndIf
    EndFunc

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

    Func _CaretPos()
    Local $old = Opt("CaretCoordMode", 0) ;relative mode
    Local $c = WinGetCaretPos() ;relative caret coords
    Local $w = WinGetPos("") ;window's coords
    Local $f = ControlGetFocus("","") ;text region "handle"
    Local $e = ControlGetPos("", "", $f) ;text region coords
    Local $h = ControlGetHandle("", "", $f) ;Ctrl-Handle
    Local $t[5]
    If IsArray($c) and IsArray($w) and IsArray($e) Then
    If _WinAPI_IsClassName($SenseCtrl, 'Edit') Then ; Input wird als Edit-Class erkannt
    $t[0] = $c[0] + $w[0] + $e[0]
    ElseIf _WinAPI_IsClassName($SenseCtrl, 'ComboBox') Then
    $t[0] = $w[0] + $e[0]
    EndIf
    $t[1] = $c[1] + $w[1] + $e[1]
    $t[2] = $h
    $t[3] = $w[1]
    $t[4] = $e[1]
    Opt("CaretCoordMode", $old)
    Return $t ;absolute screen coords of caret cursor
    Else
    Opt("CaretCoordMode", $old)
    SetError(1)
    EndIf
    EndFunc
    #endregion - SenseFuncs

    [/autoit]
  • Vielen vielen dank BugFix!
    Du hast mir quasi meinen Schlaf gerettet ;)
    Nun läuft mein Programm so wie es soll.
    Ich optimier noch ein bischen und werde dann mein Programm im Scripte Bereich vorstellen.