Jump to content

Next > Next > next aso.


Rex
 Share

Recommended Posts

Hi i'm trying to create a gui with one main gui and some childs, with a back and a next button.

My problem is i can't finde out how to get the script to keep switch to the next child when a user cliks next :P

#include <GuiConstants.au3>

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

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

GuiSetState()

$Child_1 = GuiCreate("", 506, 238,0, 0, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)

$Label_1 = GuiCtrlCreateLabel("Child 1", 20, 20, 230, 30)

GuiSetState()

$Child_2 = GuiCreate("", 506, 238,0, 0, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)

$Label_1 = GuiCtrlCreateLabel("Child 2.", 30, 40, 290, 30)

GuiSetState(@SW_HIDE)

$Child_3 = GuiCreate("", 506, 238,0, 0, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)

$Label_1 = GuiCtrlCreateLabel("Child 3.", 30, 40, 290, 30)

GuiSetState(@SW_HIDE)

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        GUISetState(@SW_HIDE, $child_1)
        GUISetState(@SW_SHOW, $child_2)
    ;;;
    EndSelect
WEnd

Please can some one help me with this little problem ;)

Link to comment
Share on other sites

wenever i make more than 1 gui i always put em in seperate functions so i dont have to deal with all that child crap and different messages

But then you don't get the same cool function as you can with childs ;)
Link to comment
Share on other sites

here ya go

#include <GuiConstants.au3>

Dim $show = 0

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

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

GuiSetState()

$Child_1 = GuiCreate("", 506, 238,0, 0, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)

$Label_1 = GuiCtrlCreateLabel("Child 1", 20, 20, 230, 30)

GuiSetState()

$Child_2 = GuiCreate("", 506, 238,0, 0, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)

$Label_1 = GuiCtrlCreateLabel("Child 2.", 30, 40, 290, 30)

GuiSetState(@SW_HIDE)

$Child_3 = GuiCreate("", 506, 238,0, 0, BitOr($WS_CHILD,$WS_TABSTOP)+$WS_DLGFRAME ,-1, $main)

$Label_1 = GuiCtrlCreateLabel("Child 3.", 30, 40, 290, 30)

GuiSetState(@SW_HIDE)

While 1
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button_1
    Set_Show()
;;;
EndSelect
WEnd


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

Func Set_Show()
    
    If $Show = 0 Then
        GUISetState(@SW_HIDE, $child_1)
        GUISetState(@SW_SHOW, $child_2)
        $Show = 1
        Return
    EndIf
    
    If $Show = 1 Then
        GUISetState(@SW_SHOW, $child_1)
        GUISetState(@SW_HIDE, $child_2)
        $Show = 0
        Return
    EndIf
    
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

here ya go

Case $msg = $Button_1
    Set_Show()
;;;
EndSelect
WEnd
;--------- Functions -------------------

Func Set_Show()
    
    If $Show = 0 Then
        GUISetState(@SW_HIDE, $child_1)
        GUISetState(@SW_SHOW, $child_2)
        $Show = 1
        Return
    EndIf
    
    If $Show = 1 Then
        GUISetState(@SW_SHOW, $child_1)
        GUISetState(@SW_HIDE, $child_2)
        $Show = 0
        Return
    EndIf
    
EndFunc

8)

thx

why oh why did't i think of that ;) It so simpel

I was begining to mess around with add one, or array'er som thing like that :P

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...