Sign in to follow this  
Followers 0
bertjeNL

Help with Installation Wizard (Newbie)

4 posts in this topic

Hi all,

I am from Holland so please forgive me my bad English.

The problem i am having is in the script.

I hope you can help me.....

Thx,

#cs
Hi, with this script i want to make a Installation Wizard.

My Problem is: I want to keep ONE window and in that window the buttons and text have to be changed.
The users of it have to be able to go to the NEXT AND PREVIOUS window.
This i can't manage. I keep getting a new screen. If i put "GUISetState(@SW_HIDE)" in it, the screen is "flashing". I don't want that.

Another problem: For every line of text i have to make a new label. Very unpleasant.

Also i want an option to choose a destination for the files that have to be installed. I didn't get to that yet.
#ce

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)

Global $ExitBut, $YesNo, $NextBut, $PrevBut, $Window, $NonExist

;The first(intro) window.

main()

Func main()

    $Window = GUICreate("Installation", 601, 301, 204, 123)
    GUISetBkColor(0x3D95FF)

    GUICtrlCreateLabel("Welcome,", 120, 56, 57, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUICtrlCreateLabel("This Wizard......", 120, 94, 332, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUICtrlCreateLabel("More text", 120, 108, 207, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUICtrlCreateLabel("More text", 120, 122, 53, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUICtrlCreateLabel("Click next to start the installation", 120, 184, 308, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $NextBut = GUICtrlCreateButton("&Next", 380, 248, 75, 25, $WS_GROUP)
    GUICtrlSetCursor (-1, 0)
    GUICtrlSetOnEvent($NextBut, "NextBut1")
    $ExitBut = GUICtrlCreateButton("&Exit", 472, 248, 75, 25, $WS_GROUP)
    GUICtrlSetCursor (-1, 0)
    GUICtrlSetOnEvent($ExitBut, "ExitBut")

    GUISetOnEvent($GUI_EVENT_CLOSE, "ExitBut")

    GUISetState(@SW_SHOW)

    While 1
        Sleep(1)
    WEnd
EndFunc

;The Functions for first(intro) window.

Func ExitBut()
    $YesNo = MsgBox(4, "Confirm", "Are you sure you want to quit?")
    If $YesNo = 6 Then
        Exit
    EndIf
    If $YesNo = 7 Then
    EndIf
EndFunc

;This Function has to create new text or something in the same window after you press "Next". It doesn't work. It loads a new window.

Func NextBut1()
    $Window = GUICreate("Installation", 601, 301, 204, 123)
    GUISetBkColor(0x3D95FF)

    ; Here i want some text or the option to choose the destination.

    $NextBut = GUICtrlCreateButton("&Next", 380, 248, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent($NextBut, "NextBut2")
    GUICtrlSetCursor (-1, 0)
    $ExitBut = GUICtrlCreateButton("&Exit", 472, 248, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent($ExitBut, "ExitBut")
    GUICtrlSetCursor (-1, 0)
    $PrevBut = GUICtrlCreateButton("&Previous", 288, 248, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent($PrevBut, "PrevBut1")
    GUICtrlSetCursor (-1, 0)

    GUISetOnEvent($GUI_EVENT_CLOSE, "ExitBut")

    GUISetState(@SW_SHOW)
EndFunc

Func NextBut2()
    Local $NonExist

    $NonExist = MsgBox(0, "Nonexistent", "This Window does not exist yet")
    If $NonExist = 1 Then
    EndIf
EndFunc

Func PrevBut1()
    Local $HelpCreator

    $HelpCreator = MsgBox(0, "Help!", "This button should make you see the previous window. The creator of this scipt does not know how to do this. Please help him!")
    If $HelpCreator = 1 Then
    EndIf
EndFunc

Share this post


Link to post
Share on other sites



#cs
Hi, with this script i want to make a Installation Wizard.

My Problem is: I want to keep ONE window and in that window the buttons and text have to be changed.
The users of it have to be able to go to the NEXT AND PREVIOUS window.
This i can't manage. I keep getting a new screen. If i put "GUISetState(@SW_HIDE)" in it, the screen is "flashing". I don't want that.

Another problem: For every line of text i have to make a new label. Very unpleasant.

Also i want an option to choose a destination for the files that have to be installed. I didn't get to that yet.
#ce

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)

Global $ExitBut, $YesNo, $NextBut, $PrevBut, $Window, $NonExist

;The first(intro) window.

main()

Func main()

    $Window = GUICreate("Installation", 601, 301, 204, 123)
    GUISetBkColor(0x3D95FF)

    GUICtrlCreateLabel("Welcome,", 120, 56, 57, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUICtrlCreateLabel("This Wizard......", 120, 94, 332, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUICtrlCreateLabel("More text", 120, 108, 207, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUICtrlCreateLabel("More text", 120, 122, 53, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUICtrlCreateLabel("Click next to start the installation", 120, 184, 308, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $NextBut = GUICtrlCreateButton("&Next", 380, 248, 75, 25, $WS_GROUP)
    GUICtrlSetCursor (-1, 0)
    GUICtrlSetOnEvent($NextBut, "NextBut1")
    $ExitBut = GUICtrlCreateButton("&Exit", 472, 248, 75, 25, $WS_GROUP)
    GUICtrlSetCursor (-1, 0)
    GUICtrlSetOnEvent($ExitBut, "ExitBut")

    GUISetOnEvent($GUI_EVENT_CLOSE, "ExitBut")

    GUISetState(@SW_SHOW)

    While 1
        Sleep(1)
    WEnd
EndFunc

;The Functions for first(intro) window.

Func ExitBut()
    $YesNo = MsgBox(4, "Confirm", "Are you sure you want to quit?")
    If $YesNo = 6 Then
        Exit
    EndIf
    If $YesNo = 7 Then
    EndIf
EndFunc

;This Function has to create new text or something in the same window after you press "Next". It doesn't work. It loads a new window.

Func NextBut1()
    $Window = GUICreate("Installation", 601, 301, 204, 123)
    GUISetBkColor(0x3D95FF)

    ; Here i want some text or the option to choose the destination.

    $NextBut = GUICtrlCreateButton("&Next", 380, 248, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent($NextBut, "NextBut2")
    GUICtrlSetCursor (-1, 0)
    $ExitBut = GUICtrlCreateButton("&Exit", 472, 248, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent($ExitBut, "ExitBut")
    GUICtrlSetCursor (-1, 0)
    $PrevBut = GUICtrlCreateButton("&Previous", 288, 248, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent($PrevBut, "PrevBut1")
    GUICtrlSetCursor (-1, 0)

    GUISetOnEvent($GUI_EVENT_CLOSE, "ExitBut")

    GUISetState(@SW_SHOW)
EndFunc

Func NextBut2()
    Local $NonExist

    $NonExist = MsgBox(0, "Nonexistent", "This Window does not exist yet")
    If $NonExist = 1 Then
    EndIf
EndFunc

Func PrevBut1()
    Local $HelpCreator

    $HelpCreator = MsgBox(0, "Help!", "This button should make you see the previous window. The creator of this scipt does not know how to do this. Please help him!")
    If $HelpCreator = 1 Then
    EndIf
EndFunc
This is better i think. Don't know this Forum, sry.

Share this post


Link to post
Share on other sites

Can somebody please help me with this?

Do you understand my problem or do i have to explain it?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi bertjeNL,

I deal with things like this by creating all the buttons, labels etc on one page, which looks like a big mess! I then use GUICtrlSetState($button1,$GUI_HIDE) on all the elemenents that will be needed later on. The advantage of this is that you only have one GUI to poll. You end up with something like this:-

switch GUIGetMsg

case $button1

;hide this, show that

case $button2

;hide that, show this

etc etc

endswitch

I've used this approach succesfully in numerous programs, but I am a rank amateur - there's probably someone on here with a much more elegant solution.

Incidentally, you don't need to keep declaring the font - the previous one will be used unless you tell it otherwise.

Hope I've made sense!

Simbo

Edited by simbo

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0