deadbug Posted January 23, 2009 Posted January 23, 2009 I realise that this is a basic question but this is my first GUI app I've poked around the forum a little, read the help and looked at some examples but I'm still not sure of the right way to do this.I start out with a splash screen:CODE$screen = GUICreate($title, 821, 701, 191, 120)draw stuff in it and then wait for the user to hit "Next". Now I want to draw the subsequent screen.So should I delete $screen and create a new one or keep the existing one and redraw it? (The screens will all be the same size).
billthecreator Posted January 24, 2009 Posted January 24, 2009 make a set of buttons and stuff and set each set GUI_DISABLE then when you click next. GUI_ENABLE [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap
billthecreator Posted January 24, 2009 Posted January 24, 2009 this is an old script i made for an installer. its similar to what your asking. expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=CharIn.ico #AutoIt3Wrapper_UseAnsi=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> Global $var #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("CharInstaller", 347, 232, -1, -1) $cancel = GUICtrlCreateButton("&Cancel", 8, 200, 57, 25, 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $back = GUICtrlCreateButton("< &Back", 216, 200, 57, 25, 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_DISABLE) $next1 = GUICtrlCreateButton("&Next >", 280, 200, 57, 25, 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_DISABLE) $Group1 = GUICtrlCreateGroup("", 8, 184, 329, 9) GUICtrlCreateGroup("", -99, -99, 1, 1) $Edit1 = GUICtrlCreateEdit("", 8, 64, 329, 97, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL)) GUICtrlSetData(-1, "FREEWARE"&@CRLF&@CRLF&"1. There is no lisence."&@CRLF&@CRLF&"2. Do what ever you want."&@CRLF&@CRLF&"You must agree with nothing to continue.") GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_DISABLE) $Radio1 = GUICtrlCreateRadio("I do not agree", 8, 168, 97, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Radio2 = GUICtrlCreateRadio("I &Agree", 112, 168, 65, 17) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Icon1 = GUICtrlCreateIcon("C:\Windows\System32\shell32.dll", -43, 16, 8, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP)) $Label5 = GUICtrlCreateLabel("Terms and conditions", 56, 8, 124, 19) GUICtrlSetFont(-1, 9, 400, 0, "Arial") ;second part $Label2 = GUICtrlCreateLabel("This will install Character Shortcut and its components " & @CRLF & "on to your computer. Select which option you would like on your computer.", 58, 8, 270, 38) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_hide) $back2 = GUICtrlCreateButton("< Back", 216, 200, 57, 25, 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_hide) $Checkbox1 = GUICtrlCreateCheckbox("Create Desktop Shortcut", 56, 55, 217, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetState(-1, $GUI_hide) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Checkbox2 = GUICtrlCreateCheckbox("Run Program When Finished", 56, 79, 227, 17) GUICtrlSetState(-1, $GUI_CHECKED) GUICtrlSetState(-1, $GUI_hide) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $next2 = GUICtrlCreateButton("Next >", 280, 200, 57, 25, 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_hide) ;third part $next3 = GUICtrlCreateButton("Install", 280, 200, 57, 25, 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_hide) $Label3 = GUICtrlCreateLabel("Please select the installation folder.", 58, 8, 270, 22) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_hide) $Label4 = GUICtrlCreateLabel("Select the folder to install Character Shortcut:", 16, 64, 220, 17) GUICtrlSetState(-1, $GUI_hide) GUICtrlSetFont(-1, 8, 400, 0, "Arial") $Input1 = GUICtrlCreateInput(@UserProfileDir, 16, 88, 257, 21) GUICtrlSetState(-1, $GUI_hide) $browse = GUICtrlCreateButton("Browse...", 280, 88, 57, 21, $BS_CENTER) GUICtrlSetState(-1, $GUI_hide) $back3 = GUICtrlCreateButton("< Back", 216, 200, 57, 25, 0) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUICtrlSetState(-1, $GUI_hide) ;forth part $Progress1 = GUICtrlCreateProgress(16, 128, 312, 15) GUICtrlSetState(-1, $GUI_hide) $Label1 = GUICtrlCreateLabel("", 16, 104, 254, 14) GUICtrlSetState(-1, $GUI_hide) GUICtrlSetFont(-1, 8, 400, 0, "Arial") GUISetState(@SW_SHOW) #EndRegion ### START Koda GUI section ### Form= $GroupA = StringSplit($next1 & "+" & $Label5 & "+" & $Radio1 & "+" & $Radio2 & "+" & $Edit1,"+") $GroupB = StringSplit($Label2 & "+" & $Checkbox1 & "+" & $Checkbox2 & "+" & $back2 & "+" & $next2,"+") $GroupC = StringSplit($Label3 & "+" & $Label4 & "+" & $Input1 & "+" & $browse & "+" & $back3 & "+" & $next3,"+") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $cancel Exit Case $Radio2 GUICtrlSetState($next1, $GUI_ENABLE) Case $Radio1 GUICtrlSetState($next1, $GUI_DISABLE) Case $next1 _GuiCtrlGroupSetState($GroupA, $GUI_HIDE) _GuiCtrlGroupSetState($GroupB, $GUI_SHOW) Case $next2 _GuiCtrlGroupSetState($GroupB, $GUI_HIDE) _GuiCtrlGroupSetState($GroupC, $GUI_SHOW) Case $back2 _GuiCtrlGroupSetState($GroupA, $GUI_SHOW) _GuiCtrlGroupSetState($GroupB, $GUI_HIDE) Case $back3 _GuiCtrlGroupSetState($GroupB, $GUI_SHOW) _GuiCtrlGroupSetState($GroupC, $GUI_HIDE) Case $next3 _GuiCtrlGroupSetState($GroupC, $GUI_HIDE) GUICtrlSetState($Progress1, $GUI_SHOW) GUICtrlSetState($Label1, $GUI_SHOW) Sleep(1000) _Install() Case $browse $var = FileSelectFolder("Choose a folder.", @UserProfileDir, 7) If @error Then Else GUICtrlSetData($Input1, $var) EndIf EndSwitch WEnd Func _Install() $var = GUICtrlRead($Input1) For $r = 1 To 50 Sleep(Random(100, 500, 1)) GUICtrlSetData($Progress1, $r) GUICtrlSetData($Label2, $r & "%") GUICtrlSetData($Label1, "Installing: " & "\CharShortcutv3.exe") Next GUICtrlSetData($Label1, "Checking for users saved settings...") For $r = 51 To 69 Sleep(200) GUICtrlSetData($Progress1, $r) GUICtrlSetData($Label2, $r & "%") Next If FileExists($var & "\CharShortcutConfig.ini") Then Sleep(1000) GUICtrlSetData($Label1, "Settings exist...") Sleep(1000) GUICtrlSetData($Progress1, 100) GUICtrlSetData($Label2, "100%") Sleep(1000) Else GUICtrlSetData($Label1, "Settings do not exist...") Sleep(2000) GUICtrlSetData($Label1, "Installing settings...") For $r = 70 To 100 Sleep(200) GUICtrlSetData($Progress1, $r) GUICtrlSetData($Label2, $r & "%") Next Sleep(1000) EndIf If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then EndIf _finished() EndFunc ;==>_1 Func _finished() GUICtrlSetData($Label1, "Finished.") Sleep(3000) If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then Run($var & "\CharShortcutv3.exe") EndIf Exit EndFunc ;==>_finished Func _GuiCtrlGroupSetState(ByRef $a_GroupArray, $i_State) For $i = 1 To $a_GroupArray[0] GUICtrlSetState($a_GroupArray[$i], $i_State) Next EndFunc ;==>_GuiCtrlGroupSetState [font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap
deadbug Posted January 24, 2009 Author Posted January 24, 2009 this is an old script i made for an installer. its similar to what your asking.Thanks for that. It looks like your script creates one GUI and then Hides/Shows controls as required. For some reason mine didn't work properly when I tried that yesterday. Currently it creates a GUI per screen and Hides/Shows the whole GUI. That's not working as I'd like either. I think I'll put together a simple multiscreen example and, if I cannot get that working properly, I'll post here.Thanks for the input.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now