Hab mal wieder was gebastelt.
Das ganze ist noch ausbaufähig, ich weiß, aber bereits einsetzbar.
Viel Spaß!
Spoiler anzeigen
#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit]Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $VisToggle = 0
[/autoit] [autoit][/autoit] [autoit]GUICreate("OwnCombo-Test", 400, 200)
GUISetOnEvent(-3, "_Exit")
GUICtrlCreatePic(StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) & "Examples\GUI\msoobe.jpg", 0, 0, 400, 200, 0)
[/autoit] [autoit][/autoit] [autoit]GUICtrlCreateLabel("OwnCombo", 20, 50, 100, 20, 0x201)
GUICtrlSetBkColor(-1, -2)
GUICtrlCreateLabel("Standard Combo", 220, 50, 100, 20, 0x201)
GUICtrlSetBkColor(-1, -2)
Global $hOwnCombo = _OwnCombo_Create("Hello1|Hello2|Hello3|Hello4|Hello5", 20, 80, 100, 80, -2)
[/autoit] [autoit][/autoit] [autoit]GUICtrlCreateCombo("", 220, 80, 100, 80)
GUICtrlSetData(-1, "Hello1|Hello2|Hello3|Hello4|Hello5", "Hello1") ; add other item snd set a new default
GUICtrlSetBkColor(-1, -2)
GUISetState()
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep(20000)
WEnd
Func _OwnCombo_Create($sText, $iLeft, $iTop, $iWidth, $iHeight, $iColor = -1)
Local $hInput, $hList, $hButton, $aText
$aText = StringSplit($sText, "|")
$hList = GUICtrlCreateListView("OwnCombo", $iLeft, $iTop + 18, $iWidth, $iHeight, BitOR(0x4000, 0x8000, 0x4, 0x8), BitOR(0x8, 0x20, 0x200))
GUICtrlSendMsg(-1, 4167, 0, 1)
GUICtrlSendMsg(-1, 4126, 0, $iWidth - 4)
GUICtrlSetState(-1, $GUI_HIDE)
$hButton = GUICtrlCreateButton("u", $iLeft + $iWidth - 18, $iTop + 2, 16, 16, Default, 0x20)
GUICtrlSetOnEvent(-1, "_OwnCombo_ShowHide")
GUICtrlSetFont(-1, 10, Default, 0, "Marlett")
$hInput = GUICtrlCreateLabel($aText[1], $iLeft, $iTop, $iWidth, 20, 0x1200)
If $iColor <> -1 Then
GUICtrlSetBkColor($hInput, $iColor)
GUICtrlSetBkColor($hList, $iColor)
EndIf
For $i = 1 To $aText[0]
GUICtrlCreateListViewItem($aText[$i], $hList)
GUICtrlSetOnEvent(-1, "_OwnCombo_SetSelText")
Next
GUICtrlSetState($hInput, $GUI_FOCUS)
Return $hList
EndFunc
Func _OwnCombo_ShowHide()
Local $CtrlID = @GUI_CtrlId - 1
$VisToggle = Not $VisToggle
GUICtrlSetState($CtrlID, $GUI_FOCUS)
If $VisToggle Then
GUICtrlSetState($CtrlID, $GUI_SHOW)
Else
GUICtrlSetState($CtrlID, $GUI_HIDE)
EndIf
EndFunc
Func _OwnCombo_SetSelText()
$VisToggle = 0
GUICtrlSetState($hOwnCombo + 2, $GUI_FOCUS)
GUICtrlSetData($hOwnCombo + 2, StringTrimRight(GUICtrlRead(GUICtrlRead($hOwnCombo)), 1))
GUICtrlSetState($hOwnCombo, $GUI_HIDE)
EndFunc
Func _Exit()
Exit
EndFunc