Tach zusammen
Also ich hab das Skript von gestern etwas weitergeführt und stehe erneut vor einem Problem.
Was SOLLTE passieren:
Sobald man in der ersten GUI den Button klickt, öffnet sich eine neue GUI, von der aus geht es dann über einen weiteren Button auf die nächste usw.
Was passiert:
Sobald man den ersten Button anklickt, öffnet sich nicht nur die erste GUI sondern auch gleich die zweite.
Meine Vermutung:
Es scheint so, als ob in der zweiten GUI das GUIGetMsg schon beim ersten durchlauf zurückgibt, dass der Button gedrückt wurde.
Um das zu veranschaulichen habe ich eine MsgBox an den Punkt gesetzt an dem eigentlich der Button gedrückt werden muss damit das Programm dorthin springt.
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <GUICtrlPic.au3>
#include <File.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
Global $ButtonX1 = ((@DesktopWidth / 2) - 313) + 480 ;Calculates the position where the button-area starts on the x-axis
Global $ButtonX2 = ((@DesktopWidth / 2) - 313) + (480 + 130) ;Calculates the position where the button-area ends on the x-axis
Global $ButtonY1 = ((@DesktopHeight / 2) - 206) + 360 ;Calculates the position where the button-area starts on the y-axis
Global $ButtonY2 = ((@DesktopHeight / 2) - 206) + (360 + 40) ;Calculates the position where the button-area ends on the y-axis
Global $test = 0 ;Used later to prevent the hover from flickering
Global $Terms ;Array that will later contain the "Terms of Use"-Text
$Form2 = GUICreate("", 626, 412, -1, -1, BitOR($WS_SYSMENU,$WS_POPUP), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE));Creates a new interface without any interaction-possibility
$Label = GUICtrlCreateLabel("", 480, 360, 130, 40)
$Pic1 = GUICtrlCreatePic(@ScriptDir &"\Backgrnd.jpg", 0, 0, 626, 412) ;Creates the background picture
$Pic2 = _GUICtrlPic_Create(@ScriptDir &"\Button.png", 480, 360, 130, 40) ;Creates another picture (with a transparent channel)
GUISetState(@SW_SHOW) ;Shows the interface
While 1
_mover($Pic2, @ScriptDir &"\Button.png", @ScriptDir &"\Button_Hover.png") ;Creates a "hover"-effect on the button-picture
$nMsg = GUIGetMsg()
$mPos = GUIGetCursorInfo()
Select
Case $mPos[0] >= 480 And $mPos[0] <= 610 And $mPos[1] >= 360 And $mPos[1] <= 400 And _IsPressed(01)
Terms()
ExitLoop
Case $nMsg = $GUI_EVENT_CLOSE
Exit
EndSelect
;~ ToolTip($mPos[0] & " - " & $mPos[1]) ;Shows the coordinates of the cursor as tooltip
WEnd
Terms()
[/autoit] [autoit][/autoit] [autoit]Func _mover($control, $bild1, $bild2) ;Function to create a "hover"-effect on the chosen picture
$mpos = GUIGetCursorInfo()
If (IsArray($mpos)) Then
If ($mpos[4] = $control) Then
If $test = 0 Then
$test = 1
_GUICtrlPic_SetImage($control, $bild2)
EndIf
Else
If $test = 1 Then
$test = 0
_GUICtrlPic_SetImage($control, $bild1)
EndIf
EndIf
EndIf
EndFunc
Func Terms()
GUIDelete($Form2)
;~ $Term = FileOpen(@ScriptDir &"\ToU.term")
;~ _FileReadToArray($Term, $Terms)
$Form1_1 = GUICreate("CryInstaller - ", 615, 438, -1, -1)
GUISetBkColor(0x000000)
$Button11 = GUICtrlCreateButton("Accept", 530, 405, 75, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFF0000)
$Button12 = GUICtrlCreateButton("Refuse", 445, 405, 75, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFF0000)
$Label1 = GUICtrlCreateLabel("Terms of Use:", 10, 120, 83, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
$Edit1 = GUICtrlCreateEdit("", 10, 140, 595, 259, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY))
GUICtrlSetData(-1, "")
$Pic1 = GUICtrlCreatePic(@ScriptDir &"\Default_Header.jpg", 0, 0, 615, 111)
GUISetState(@SW_SHOW)
While 1
$Msg = GUIGetMsg()
Switch $Msg
Case $Button11
MsgBox(0, "", "Test")
FolderSettings()
GUIDelete($Form1_1)
Case $Button12
ExitInstall()
Case $GUI_EVENT_CLOSE
ExitInstall()
EndSwitch
WEnd
EndFunc
Func FolderSettings()
$Form1_2 = GUICreate("CryInstaller - ", 615, 438, -1, -1)
GUISetBkColor(0x000000)
$Button21 = GUICtrlCreateButton("Start", 530, 405, 75, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFF0000)
$Button22 = GUICtrlCreateButton("Exit", 445, 405, 75, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFF0000)
$Input1 = GUICtrlCreateInput("", 30, 330, 476, 21)
$Pic1 = GUICtrlCreatePic(@ScriptDir &"\Default_Header.jpg", 0, 0, 611, 111)
$Button23 = GUICtrlCreateButton("Suchen...", 505, 330, 75, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFF0000)
$Checkbox1 = GUICtrlCreateCheckbox("Add desktop shortcut", 30, 285, 127, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
$Checkbox2 = GUICtrlCreateCheckbox("Launch after installation", 30, 250, 152, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUISetState(@SW_SHOW)
While 1
$nsg = GUIGetMsg()
Switch $nsg
Case $GUI_EVENT_CLOSE
ExitInstall()
EndSwitch
WEnd
EndFunc
Func Installation()
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func ExitInstall()
$Message = MsgBox(52, "Are you sure?", "This will stop and exit the installation. Do you really want to exit this?")
If $Message = 6 Then
Exit
EndIf
EndFunc
Func ValidateCrysis()
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit](Vorsichtshalber hab ich diesmal im .zip die GUICtrlPic-UDF gleich integriert.)
PS: Ich weiss, dass ich da noch ein paar leere Funktionen habe...die bekommen dann schon noch nen Inhalt ![]()