Sign in to follow this  
Followers 0
mistert

Previous button help

3 posts in this topic

Hey!

as u can see by the attached au3 file, i`ve build some test gui in order to implement a "previous button" option. (sorry for the mess in the gui - it`s a test).

my goal is:

1. being able to check the boxes in the secong page (which i`m succeed in) and next to the third page (this is ok too)

2. and then - being able go to previous page from the third page to the second, and still see my selection i made in the box (using @sw_show i guess).

3. last and the most important - being able go NEXT to the third again.

right now i don`t have the clue or the idea how to do that. going forward, mark, go back and FORWARD AGAIN.

pleas help! this will serve me in the future.

thanks a lot in advanced!

test.au3

Share this post


Link to post
Share on other sites



mistert,

Welcome to the AutoIt forum. :(

You were making your code overly complicated which made it very hard to read and maintain. I have tried to rewrite it in a more orderly fashion which I hope you agree is easier to follow. Basically, create all the GUIs at the start of the script, but only show the first. Then the Next/Prev buttons just have to Hide/Show the relevant GUIs:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Memory.au3>
#include <Excel.au3>
;-------------------------------------------------------------------------------------------------------------------
Local $font
;  ####################
;####   First Screen #####
;  ####################

$GUI_1 = GUICreate("gui gui", 400, 520)
$font = "Comic Sans MS"
$title0 = GUICtrlCreateLabel("test gui", 50, 195, 400, 70)
GUICtrlSetFont(-1, 23, 400, -1, $font)
GUICtrlSetColor($title0, 0x000080)

$font = "Comic Sans MS"
$title1 = GUICtrlCreateLabel("one two three", 115, 240, 400, 70)
GUICtrlSetFont(-1, 21, 400, -1, $font)
GUICtrlSetColor($title1, 0x000080)

;GUICtrlCreateLabel ( "text", left, top [, width [, height [, style [, exStyle]]]] )

$feb = GUICtrlCreateLabel("Feb 2010", 170, 445)
$version = GUICtrlCreateLabel("Version 1.0", 167, 460)
$rights = GUICtrlCreateLabel("All Rights Reserve ®", 145, 475)

;GUICtrlCreatePic(left,top,witdh,height
$Button_1_Next = GUICtrlCreateButton("Next", 30, 470, 100, 20)
$Button_1_Exit = GUICtrlCreateButton("Exit", 267, 470, 100, 20)

$Menu = GUICtrlCreateMenu("File")
$ExitItem = GUICtrlCreateMenuItem("Exit", $Menu)
$Help = GUICtrlCreateMenu("Help")
$About = GUICtrlCreateMenuItem("About", $Help)

GUISetState()

;  ####################
;####  Second Screen - MENU ####
;  ####################
$GUI_2 = GUICreate("MENU", 800, 680)

$font = "Comic Sans MS"
$menutitle = GUICtrlCreateLabel("MENU", 360, 10, 380, 70)
GUICtrlSetFont(-1, 20, 400, 4, $font)
GUICtrlSetColor($menutitle, 0x000080)
;GUICtrlCreateLabel ( "text", left, top [, width [, height [, style [, exStyle]]]] )

$font = "Comic Sans MS"
$menulabel = GUICtrlCreateLabel("what", 600, 60, 210, 100)
GUICtrlSetFont(-1, 10, 400, 1, $font)
GUICtrlSetColor($menulabel, 0x000000)
$font = "Comic Sans MS"
$menulabel2 = GUICtrlCreateLabel("label", 545, 80, 250, 100)
GUICtrlSetFont(-1, 10, 400, 1, $font)
GUICtrlSetColor($menulabel2, 0x000000)

$vendor1 = GUICtrlCreateCheckbox("one", 20, 180)
$vendor2 = GUICtrlCreateCheckbox("two", 20, 200)
$vendor3 = GUICtrlCreateCheckbox("three", 20, 220)

$Button_2_Next = GUICtrlCreateButton("Next", 35, 650, 100, 20)
$Button_2_Exit = GUICtrlCreateButton("Exit", 665, 650, 100, 20)

GUISetState(@SW_HIDE)

;  #####################################
;####  third Screen - windows rules ####
;  #####################################

$GUI_3 = GUICreate("We! Book Of Rules", 800, 680)
$font = "Comic Sans MS"
$title2 = GUICtrlCreateLabel("labellabel", 140, 20, 380, 70)
GUICtrlSetFont(-1, 20, 400, 4, $font)
GUICtrlSetColor($title2, 0x000080)
;GUICtrlCreateLabel ( "text", left, top [, width [, height [, style [, exStyle]]]] )

$font = "Comic Sans MS"
$thirdlabel = GUICtrlCreateLabel("sign", 620, 95, 210, 100)
GUICtrlSetFont(-1, 10, 400, 1, $font)
GUICtrlSetColor($thirdlabel, 0x000000)
$font = "Comic Sans MS"
$forthlabel = GUICtrlCreateLabel("label", 555, 115, 220, 100)
GUICtrlSetFont(-1, 10, 400, 1, $font)
GUICtrlSetColor($forthlabel, 0x000000)

$box1 = GUICtrlCreateCheckbox("001", 10, 160)
$box2 = GUICtrlCreateCheckbox("002", 10, 180)
$box3 = GUICtrlCreateCheckbox("003", 10, 200)

$Button_3_Next = GUICtrlCreateButton("Next", 35, 650, 100, 20)
$Button_3_Exit = GUICtrlCreateButton("Exit", 465, 650, 100, 20)
$Button_3_Prev = GUICtrlCreateButton("Previous", 365, 650, 100, 20)

GUISetState(@SW_HIDE)

;  ####################
;####  Fourth Screen ####
; #####################

$GUI_4 = GUICreate("Wgui", 800, 680)

$checkpnt1 = GUICtrlCreateCheckbox("099", 10, 190)
$checkpnt2 = GUICtrlCreateCheckbox("100", 10, 210)
$checkpnt3 = GUICtrlCreateCheckbox("101", 10, 230)

GUISetState(@SW_HIDE)

;  ##########
;####Vars######
;  #########
$Button_4_Next = GUICtrlCreateButton("Next", 35, 650, 100, 20)
$Button_4_Exit = GUICtrlCreateButton("Exit", 465, 650, 100, 20)
$Button_4_Prev = GUICtrlCreateButton("Previous", 160, 650, 100, 20)

GUISetState(@SW_HIDE)

;  ##################
;####   Fifth Screen    ####
;  ##################
$GUI_5 = GUICreate("gui create", 600, 680)

$font = "Comic Sans MS"
$title7 = GUICtrlCreateLabel("bla bla", 120, 49, 350, 70)
GUICtrlSetFont(-1, 20, 400, 4, $font)
GUICtrlSetColor($title7, 0x000080)
$font = "Comic Sans MS"
$ninelabel = GUICtrlCreateLabel("sign -", 439, 108, 210, 100)
GUICtrlSetFont(-1, 11, 400, 1, $font)
GUICtrlSetColor($ninelabel, 0x000000)
$font = "Comic Sans MS"
$tenlabel = GUICtrlCreateLabel("save -", 376, 127, 220, 100)
GUICtrlSetFont(-1, 11, 400, 1, $font)
GUICtrlSetColor($tenlabel, 0x000000)

GUICtrlCreateLabel("_____________________________________________________________________________________________________", 1, 145, 680, 30)

$symantec1 = GUICtrlCreateCheckbox("Security Risk found", 10, 190)
$symantec2 = GUICtrlCreateCheckbox(" Virus Storm", 10, 210)
$symantec3 = GUICtrlCreateCheckbox(" Virus found", 10, 230)

$Button_5_Next = GUICtrlCreateButton("Next", 35, 650, 100, 20)
$Button_5_Exit = GUICtrlCreateButton("Exit", 465, 650, 100, 20)
$Button_5_Prev = GUICtrlCreateButton("Previous", 160, 650, 100, 20)

GUISetState(@SW_HIDE)

; Now all GUIs created but only first visible

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $Button_1_Exit, $Button_2_Exit, $Button_3_Exit, $Button_4_Exit, $Button_5_Exit
            If MsgBox(262452, "Exit", "Are You Sure You Want To Exit?") = 6 Then Exit
        Case $Button_1_Next
            GUISetState(@SW_HIDE, $GUI_1)
            GUISetState(@SW_SHOW, $GUI_2)
        Case $Button_2_Next
            GUISetState(@SW_HIDE, $GUI_2)
            GUISetState(@SW_SHOW, $GUI_3)
        Case $Button_3_Next
            GUISetState(@SW_HIDE, $GUI_3)
            GUISetState(@SW_SHOW, $GUI_4)
        Case $Button_3_Prev
            GUISetState(@SW_HIDE, $GUI_3)
            GUISetState(@SW_SHOW, $GUI_2)
        Case $Button_4_Next
            GUISetState(@SW_HIDE, $GUI_4)
            GUISetState(@SW_SHOW, $GUI_5)
        Case $Button_4_Prev
            GUISetState(@SW_HIDE, $GUI_4)
            GUISetState(@SW_SHOW, $GUI_3)
        Case $Button_5_Next
            If GUICtrlRead($symantec1) = $GUI_CHECKED Then
                ;FileWriteLine($rulesfile, "risk")
            EndIf
            If GUICtrlRead($symantec2) = $GUI_CHECKED Then
                ;FileWriteLine($rulesfile, "storm")
            EndIf
            If GUICtrlRead($symantec3) = $GUI_CHECKED Then
                ;FileWriteLine($rulesfile, "gui")
            EndIf

            MsgBox(0, "", "rulesfile written" & @CRLF & "Now what?" )

        Case $Button_5_Prev
            GUISetState(@SW_HIDE, $GUI_5)
            GUISetState(@SW_SHOW, $GUI_4)
    EndSwitch

WEnd

I hope you can follow the code - please ask if anything is unclear. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

M23 thank u very very much!!!!

this was very helpful!

best regards!

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