Sign in to follow this  
Followers 0
vickerps

Creating multiple forms

3 posts in this topic

Hi i am currently writing a script that has several form which are accessed back and forth via a back and next button on each i have created this but im sure im doing a messy way is can anyone give me help. I look at that autoit 123 which does what im after but i can not look at the source code. The decompiler doesn't work.

Here what i have done so far

#INCLUDE <Process.au3>
#INCLUDE <File.au3>
#INCLUDE <GUIConstants.au3>

Opt("GUICoordMode",1)
$Firstwindow = GuiCreate("Firstwindow",530,300,-1,-1,$WS_SYSMENU+$WS_MINIMIZEBOX,$WS_EX_TOPMOST)
GUISetState(@SW_SHOW)

$Next1 = GUICtrlCreateButton("Next",400,225,120,40)

GUICtrlSetState(-1,$GUI_FOCUS)
GUISetState(@SW_SHOW)
; -----------------------------------------------------------------------------------------------------------------------
;  -
; -----------------------------------------------------------------------------------------------------------------------
Opt("GUICoordMode",1)
$Secondwindow = GuiCreate("Secondwindow",530,300,-1,-1,$WS_SYSMENU+$WS_MINIMIZEBOX,$WS_EX_TOPMOST)

$back1 = GUICtrlCreateButton("Back",280,225,120,40)
$Next2 = GUICtrlCreateButton("Next",400,225,120,40)
; -----------------------------------------------------------------------------------------------------------------------
;  -
; -----------------------------------------------------------------------------------------------------------------------
Opt("GUICoordMode",1)
$Thirdwindow = GuiCreate("Thirdwindow",530,300,-1,-1,$WS_SYSMENU+$WS_MINIMIZEBOX,$WS_EX_TOPMOST)

$back2 = GUICtrlCreateButton("Back",280,225,120,40)
$Finish= GUICtrlCreateButton("Finish",400,225,120,40)
; -----------------------------------------------------------------------------------------------------------------------
;  - onEvent queries
; -----------------------------------------------------------------------------------------------------------------------

; -----------------------------------------------------------------------------------------------------------------------
;  - onEvent queries when user press a button of menu button
; -----------------------------------------------------------------------------------------------------------------------
WHILE 1

$Msg=GUIGetMsg()

SELECT 

Case $msg = $Next1
    
    GUISwitch($Secondwindow)
    GUISetState(@SW_SHOW)
    GUISwitch($Firstwindow)
    GUISetState (@SW_HIDE)

Case $msg = $Next2
    
    GUISwitch($Thirdwindow)
    GUISetState(@SW_SHOW)
    GUISwitch($Secondwindow)
    GUISetState (@SW_HIDE)

Case $msg = $back1
    GUISwitch($Firstwindow)
    GUISetState (@SW_SHOW)
    GUISwitch($Secondwindow)
    GUISetState(@SW_HIDE)

Case $msg = $back2
    GUISwitch($Secondwindow)
    GUISetState (@SW_SHOW)
    GUISwitch($Thirdwindow)
    GUISetState(@SW_HIDE)

Case $msg = $GUI_EVENT_CLOSE 

    EXIT

Case $msg = $Finish
    GUISwitch($Thirdwindow)
    GUISetState(@SW_HIDE) 
    ExitLoop

EndSelect
WEnd

msgbox(0,"Finished","Bye")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If I wasn't at school I'd provide a example but here are some pointers.

1. You could just put all the controls on the same GUI and hide/unhide those with GuiCtrlSetState()

2. Instead of using GuiSwitch() so much you could do for example, GUISetState(@SW_SHOW,$Firstwindow)

Hallman

Edited by Hallman

Share this post


Link to post
Share on other sites

If I wasn't at school I'd provide a example but here are some pointers.

1. You could just put all the controls on the same GUI and hide/unhide those with GuiCtrlSetState()

2. Instead of using GuiSwitch() so much you could do for example, GUISetState(@SW_SHOW,$Firstwindow)

Hallman

Thank for the reply. I don't think point 1 is pratical seeing for amount of controls i would be using. I will give point 2 ago never thought of doing it that way thanks. What i am trying to achieve with the multiple forms is somthing like a sysprep utility. Autoit 1-2-3 uses the method i am trying to do on the "Scripts and Scraps" page.

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