Hi Leute,
ich arbeite im Moment an einem kleinen Projekt für mich, deshalb ist der Code auch so unsauber und dort habe ich ein komisches Verhalten festgestellt.
Ich habe verschiedene ComboBoxen und je nachdem welche ich auswähle ändert sich die zweite ComboBox, dabei ist mir etwas aufgefallen:
Wenn ich in dem Programm "Days of Ahoul" auswähle, dann nimmt er den Inhalt von "Pillars of Avalon". Dann habe ich erstmal alles auf die ComboBoxen geschoben und habe die Elemente bei jeder Änderung löschen und neu erstellen lassen. Als das auch nichts half habe ich einfach mal Debug "Console Writes" erstellt und siehe da:
Oben steht ja if $SelectedItem = 2 Then ConsoleWrite(blablabla), aber das trifft nie ein. Das heißt eigentlich müsste ja dann unten in dem if Befehl die Schleife durch Days of Ahoul durchgehen, tut sie aber nicht.
Dann ist mir noch weiterhin aufgefallen, dass wenn ich von "Siege of Avalon" die Maus ohne "Pillars of Avalon" zu berühren direkt auf "Days of Ahoul" schiebe, das Programm "Days of Ahoul" erkennt.
Wieso ist mir schleierhaft, vieleicht könnt ihr mir helfen
Spoiler anzeigen
$SelectedItem = 0
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
; $BackupPath = IniRead("ModToolConfig.ini","main","BackupPath",@ScriptDir & "\BackupFiles")
;$PoAInstalled = IniRead("ModToolConfig.ini","mods","PoAInstalled","error")
; $DoAInstalled = IniRead("ModToolConfig.ini","mods","DoAInstalled","error")
;$ActivatedGame = IniRead("ModToolConfig.ini","mods","ActivatedGame","error")
$PoAInstalled = 0
$DoAInstalled = 0
ConsoleWrite($BackupPath & @CRLF & $PoAInstalled & @CRLF & $DoAInstalled & @CRLF & $ActivatedGame & @CRLF)
;If $PoAInstalled = "error" or $DoAInstalled = "error" or $ActivatedGame = "error" Then
; MsgBox(16,"SoA Mod Tool","ERROR, ini konnte nicht gelesen werden")
; Exit
;EndIf
#Region ### START Koda GUI section ### Form=D:\Extras\Programmieren\AUTOIT\Koda Forms\SoA Mod Tool.kxf
Global $Form_main1 = GUICreate("SoA Mod Tool", 679, 63, 238, 140)
Global $Combo_main1 = GUICtrlCreateCombo("Siege of Avalon", 0, 24, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Pillars of Avalon|Days of Ahoul","")
$Label_main1 = GUICtrlCreateLabel("Spiel auswählen", 56, 0, 119, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label_main2 = GUICtrlCreateLabel("Kapitel auswählen", 264, 0, 132, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
Global $Combo_main2 = GUICtrlCreateCombo("Bitte wählen", 224, 24, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetState(-1, $GUI_DISABLE)
$Button_main1 = GUICtrlCreateButton("Installieren", 440, 24, 233, 33)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
;ConsoleWrite(GUICtrlRead($Combo_main1))
If $SelectedItem = 2 Then
ConsoleWrite($SelectedItem & @CRLF)
EndIf
If GUICtrlRead($Combo_main1) = 'Pillars of Avalon' and Not $SelectedItem = 1 Then
ConsoleWrite("Pillars of Avalon" & @CRLF)
GUICtrlSetState($Combo_main2,$GUI_ENABLE)
If $PoAInstalled = 0 or $PoAInstalled = 1 Then
GUICtrlDelete($Combo_main2)
$Combo_main2 = GUICtrlCreateCombo("Kapitel 1", 224, 24, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Kapitel 2|Kapitel 3|Alle Kapitel")
ElseIf $PoAInstalled = 2 Then
GUICtrlDelete($Combo_main2)
$Combo_main2 = GUICtrlCreateCombo("Kapitel 1+2", 224, 24, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Kapitel 3")
ElseIf $PoAInstalled = 3 Then
GUICtrlDelete($Combo_main2)
$Combo_main2 = GUICtrlCreateCombo("Alle Kapitel", 224, 24, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
Else
MsgBox(16,"SoA Mod Tool","Ungültiger Install-Wert(hör auf an der ini rumzufummeln!")
EndIf
$SelectedItem = 1
ElseIf GUICtrlRead($Combo_main1) = 'Days of Ahoul' and Not $SelectedItem = 2 Then
ConsoleWrite("Days of Ahoul" & @CRLF)
$SelectedItem = 2
GUICtrlSetState($Combo_main2,$GUI_ENABLE)
If $DoAInstalled = 0 or $DoAInstalled = 1 Then
GUICtrlDelete($Combo_main2)
$Combo_main2 = GUICtrlCreateCombo("Kapitel 1", 224, 24, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1,"Kapitel 2|Alle Kapitel")
ElseIf $DoAInstalled = 2 Then
GUICtrlDelete($Combo_main2)
$Combo_main2 = GUICtrlCreateCombo("Alle Kapitel", 224, 24, 209, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
Endif
ElseIf GuiCtrlRead($Combo_main1) = 'Siege of Avalon' and not $SelectedItem = 0 Then
ConsoleWrite("Siege of Avalon" & @CRLF)
$SelectedItem = 0
GUICtrlSetState($Combo_main2,$GUI_DISABLE)
GUICtrlSetState($Button_main1,$GUI_ENABLE)
GUICtrlSetData($Button_main1,"Aktivieren")
EndIf
WEnd
Mfg Fliwatt