Jump to content
Sign in to follow this  
Matz

GUI with next and back... best practice?

Recommended Posts

Hi.

I'm developing a GUI where the users are guided through 5 steps, with Next and Back buttons. The 5 steps is in the same Window/GUI, but different content, buttons, labels, in each step. Very similar to a wizard...

I've looked a bit on GuiCreate/GuiDelete and @SW_Show/Hide...

Anyone got a tip on whats the best way to do this?

Kind regards. Mats

-------------------------------------------

:P Have you tried the new vista?

:nuke: No... I don't play games!

Share this post


Link to post
Share on other sites

Hi.

I'm developing a GUI where the users are guided through 5 steps, with Next and Back buttons. The 5 steps is in the same Window/GUI, but different content, buttons, labels, in each step. Very similar to a wizard...

I've looked a bit on GuiCreate/GuiDelete and @SW_Show/Hide...

Anyone got a tip on whats the best way to do this?

Kind regards. Mats

-------------------------------------------

:P Have you tried the new vista?

:nuke: No... I don't play games!

Might want to take a look at using Tabs instead. Can make it so that tab 2 can only be accessed from tab 1 and tab 3 can only be accessed from tab 2 and so on.

Share this post


Link to post
Share on other sites

I thought about using groupbox for each page with all controls inside

and by buttons Back/Next only change

GUICtrlSetState($GroupXX, $GUI_SHOW/$GUI_HIDE)

But I tested it and when I set

GUICtrlSetState($Group1, $GUI_HIDE)

then controls inside that groupbox are still visible!

Isn't this behaviour BUG of AutoIt?

Share this post


Link to post
Share on other sites

Might want to take a look at using Tabs instead. Can make it so that tab 2 can only be accessed from tab 1 and tab 3 can only be accessed from tab 2 and so on.

I tried that one.. but I have a nice background image that really makes the tool, and the tab destroys the bk, unless I can make the tab transparent?

Also I'm making a button menu on the top. The users need it in with a spoon :P Can the buttons trigger a tab?

I guess I can try to:

- Main window thats hidden. Just for the app in taskbar.

- Child(1) window, that show the app.

- When next is clicked. The window $position of the child(1) window is set, Winmove Child(2) window to $position, then @sw_hide child(1) and @sw_show child(2)

--- Mats ---

Share this post


Link to post
Share on other sites

This way is much easier:

$Gui1 = GuiCreate("")
$Btn = GuiCtrlCreateButton("X",10,10)

$Gui2 = GuiCreate("")
$Btn2 = Guictrlcreatebutton("Y",10,10)

GuiSetState( @SW_SHOW, $Gui1)
Do 
$msg = GUIGetMsg()
If $Msg = $Btn Then
GuiSetstate( @SW_SHOW, $Gui2 )
GuiSetstate( @SW_HIDE, $Gui1 )
ElseIf $Msg = $Btn2 Then
GuiSetstate( @SW_SHOW, $Gui1 )
GuiSetstate( @SW_HIDE, $Gui2 )
EndIf
Until $msg = -3

--------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]

Share this post


Link to post
Share on other sites

how to handle 10 children

#include <GuiConstants.au3>

Dim $show = 0, $Child_[11], $children = 10

$Main = GuiCreate("MyGUI", 516, 323, (@DesktopWidth-516)/2, (@DesktopHeight-323)/2)

$Button_1 = GuiCtrlCreateButton("&Next >", 335, 290, 80, 25)
$Button_2 = GuiCtrlCreateButton("< &Back", 250, 290, 80, 25)
$Button_3 = GuiCtrlCreateButton("&Exit", 420, 290, 80, 25)
$Button_6 = GuiCtrlCreateButton("", 10, 270, 495, 3, -1, $WS_EX_STATICEDGE)

GuiSetState()

$Child_[1] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 1", 10, 10, 230, 30)
GuiSetState()

$Child_[2] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 2.", 20, 20, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[3] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 3.", 30, 30, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[4] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 4.", 40, 40, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[5] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 5.", 50, 50, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[6] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 6.", 60, 60, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[7] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 7.", 70, 70, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[8] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 8.", 80, 80, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[9] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 9.", 90, 90, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[10] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 10..... You Must be Nuts if you have ... 10 Children!!!", 50, 100, 390, 30)
GUICtrlSetFont(-1, 10, 650)
GuiSetState(@SW_HIDE)

While 1
$msg = GuiGetMsg()

Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_3
ExitLoop
Case $msg = $Button_1
    Set_Next()
Case $msg = $Button_2
    Set_Back()
;;;
EndSelect
WEnd


;--------- Functions -------------------

Func Set_Next()
    
    For $x = 1 to $children -1
        $Nwin = WinGetState( $child_[$x] )
        If $Nwin  > 5 Then
            GuiSetState( @SW_HIDE, $child_[$x])
            GuiSetState( @SW_SHOW, $child_[$x +1])
            Return
        EndIf
    Next
    
EndFunc

Func Set_Back()
    
    For $x = $children To 1 Step -1
        $Nwin = WinGetState( $child_[$x] )
        If $Nwin  > 5 Then
            GuiSetState( @SW_HIDE, $child_[$x])
            GuiSetState( @SW_SHOW, $child_[$x -1])
            Return
        EndIf
    Next
    
EndFunc

8)

Share this post


Link to post
Share on other sites

how to handle 10 children

#include <GuiConstants.au3>

Dim $show = 0, $Child_[11], $children = 10

$Main = GuiCreate("MyGUI", 516, 323, (@DesktopWidth-516)/2, (@DesktopHeight-323)/2)

$Button_1 = GuiCtrlCreateButton("&Next >", 335, 290, 80, 25)
$Button_2 = GuiCtrlCreateButton("< &Back", 250, 290, 80, 25)
$Button_3 = GuiCtrlCreateButton("&Exit", 420, 290, 80, 25)
$Button_6 = GuiCtrlCreateButton("", 10, 270, 495, 3, -1, $WS_EX_STATICEDGE)

GuiSetState()

$Child_[1] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 1", 10, 10, 230, 30)
GuiSetState()

$Child_[2] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 2.", 20, 20, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[3] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 3.", 30, 30, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[4] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 4.", 40, 40, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[5] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 5.", 50, 50, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[6] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 6.", 60, 60, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[7] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 7.", 70, 70, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[8] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 8.", 80, 80, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[9] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 9.", 90, 90, 290, 30)
GuiSetState(@SW_HIDE)

$Child_[10] = GuiCreate("", 508, 238, 1, 1, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)
$Label_1 = GuiCtrlCreateLabel("Child 10..... You Must be Nuts if you have ... 10 Children!!!", 50, 100, 390, 30)
GUICtrlSetFont(-1, 10, 650)
GuiSetState(@SW_HIDE)

While 1
$msg = GuiGetMsg()

Select
Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_3
ExitLoop
Case $msg = $Button_1
    Set_Next()
Case $msg = $Button_2
    Set_Back()
;;;
EndSelect
WEnd
;--------- Functions -------------------

Func Set_Next()
    
    For $x = 1 to $children -1
        $Nwin = WinGetState( $child_[$x] )
        If $Nwin  > 5 Then
            GuiSetState( @SW_HIDE, $child_[$x])
            GuiSetState( @SW_SHOW, $child_[$x +1])
            Return
        EndIf
    Next
    
EndFunc

Func Set_Back()
    
    For $x = $children To 1 Step -1
        $Nwin = WinGetState( $child_[$x] )
        If $Nwin  > 5 Then
            GuiSetState( @SW_HIDE, $child_[$x])
            GuiSetState( @SW_SHOW, $child_[$x -1])
            Return
        EndIf
    Next
    
EndFunc

8)

I really liked this one :) It was something like this I was thinking about... Cause several GuiCreate with @sw_show/hide will show the labels on the taskbar disappear and appear.

Thanks :P

----------------------------------------------------

:nuke: Have you tried the new vista?

:D No, I don't play games...

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  

×
×
  • Create New...