Hallo Autoit'ler
habe ein problem mit meinem script. habs mal auf das wichtigste runtergekürzt um euch das Problem besser erklären zu können (lasst euch nicht vom aussehn ablenken, is ja gekürzt
Spoiler anzeigen
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#NoTrayIcon
Opt('GUIResizeMode', 802)
Global $iCount = 1, $iHeight = 145, $iPosH = 60, $chr = Chr(34)
Global $aCombo[$iCount], $aInput[$iCount], $aCheckbox[$iCount]
$Schnitzel = GUICreate("Programm", 500, $iHeight - 65, (@DesktopWidth - 500)/ 4, 150)
GUICtrlCreateGroup("", 5, 0, 110, 50)
$Addbutton = GUICtrlCreateButton("+", 15, 17, 25, 25, 0)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$Delbutton = GUICtrlCreateButton("-", 49, 17, 25, 25, 0)
GUICtrlSetFont(-1, 12, 400, 0, "Arial")
$addx = GUICtrlCreateInput("", 84, 19, 20, 21, 0x2001)
GUICtrlCreateGroup("", 125, 0, 150, 50)
$accs = GUICtrlCreateCombo("", 135, 19, 131, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlCreateGroup("", 285, 0, 210, 50)
$create = GUICtrlCreateButton("Button1", 296, 17, 123, 25, 0)
$backup = GUICtrlCreateCheckbox("Check1", 428, 16, 63, 26)
$Gruppe1 = GUICtrlCreateGroup("", 5, 53, 220, $iPosH + 5)
$Gruppe2 = GUICtrlCreateGroup("", 224, 53, 222, $iPosH + 5)
$Gruppe3 = GUICtrlCreateGroup("", 445, 53, 50, $iPosH + 5)
$text1 = GUICtrlCreateLabel("Text1", 20, 67, 194, 17)
$text2 = GUICtrlCreateLabel("text2", 245, 67, 174, 17)
$text3 = GUICtrlCreateLabel("text3", 450, 67, 42)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Left()
Case $Addbutton
AddButton()
Case $Delbutton
DelButton()
Case $addx
For $addy = 1 To GUICtrlRead($addx) Step +1
AddButton()
Next
GUICtrlSetData($addx, "")
Case $create
Create()
EndSwitch
WEnd
Func AddButton()
If ($iCount <= 20) Then
HotKeySet("{NUMPADADD}")
$size = WinGetPos("")
$iCount += 1
ReDim $aCombo[$iCount], $aInput[$iCount], $aCheckbox[$iCount]
$iPosH += 30
$aCombo[$iCount - 1] = GUICtrlCreateCombo("", 14, $iPosH, 205, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData($aCombo[$iCount - 1], "Auswahl1|Auswahl2|Auswahl3|Auswahl4|Auswahl5|Auswahl6")
GUICtrlSetPos($Gruppe1, 5, 53, 220, $iPosH - 25)
GUICtrlSetPos($Gruppe2, 224, 53, 222, $iPosH - 25)
GUICtrlSetPos($Gruppe3, 445, 53, 50, $iPosH - 25)
$aInput[$iCount - 1] = GUICtrlCreateInput("", 230, $iPosH, 210, 21)
$aCheckbox[$iCount - 1] = GUICtrlCreateCheckbox("", 465, ($iPosH - 4), 28, 28)
$iHeight += 30
WinMove($Schnitzel, '', $size[0], $size[1], 506, $iHeight)
HotKeySet("{NUMPADADD}","AddButton")
EndIf
EndFunc
Func DelButton()
If ($iCount > 2) Then
HotKeySet("{NUMPADSUB}")
$size = WinGetPos("")
GUICtrlDelete($aCombo[$iCount - 1])
GUICtrlDelete($aInput[$iCount - 1])
GUICtrlDelete($aCheckbox[$iCount - 1])
$iCount -= 1
ReDim $aCombo[$iCount], $aInput[$iCount], $aCheckbox[$iCount]
$iPosH -= 30
$iHeight -= 30
GUICtrlSetPos($Gruppe1, 5, 53, 220, $iPosH - 25)
GUICtrlSetPos($Gruppe2, 224, 53, 222, $iPosH - 25)
GUICtrlSetPos($Gruppe3, 445, 53, 50, $iPosH - 25)
WinMove($Schnitzel, '', $size[0], $size[1], 506, $iHeight)
HotKeySet("{NUMPADSUB}","DelButton")
EndIf
EndFunc
Func Left()
$beenden = MsgBox( 4 + 48 + 256 + 262144, "Beenden", "Soll das Programm wirklich geschlossen werden???" & @CRLF & "Alle Ungespeicherten Daten gehen damit Verloren")
if $beenden = 6 then Exit
EndFunc
Func Create()
MsgBox(0,"","Hauptfunktion")
EndFunc
Also mein problem ist:
Wenn die Combobox geändert wird soll je nach auswahl verschiedene sachen ausgeführt werden.
z.b. wenn Combobox auf Auswahl1 dann Inputbox
wenn Combobox auf auswahl2 dann schreibe etwas in die inputbox und setzte die checkbox auf Checked
usw
das funktioniert ja egtl ganz gut mit switch case. aber ich bekomms bei mir einfach nicht hin weil immer das mit dem array nicht passt
meine ideen waren zuerst:
Spoiler anzeigen
Switch $nMsg
Case $aCombo[$iCount]
MACH Irgendwas
funktioniert natürlich nicht weil $aCombo[$iCount] immer nur die letzte combobox ist
dann hab ich sowas in der art probiert:
Spoiler anzeigen
for $i = 1 to $iCount
Switch $nMsg
Case $aCombo[$iCount]
MACH Irgendwas
next
hab ich aber auch nicht hingebracht
und noch einige andere methoden von denen egtl mehr oder weniger klar war dass die nicht funktionieren.
wär cool wenn mir jemand einen vernünftigen tipp geben könnte wie es funktioniert
Mfg Schnitzel