Jump to content

Swift - as ordered


 Share

Recommended Posts

This should work...

#include <GuiConstants.au3>

Dim $show = 0, $Child_[6], $children = 5, $Radio[11]


$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)
GUICtrlSetState($Button_2, $GUI_DISABLE)
$Button_3 = GUICtrlCreateButton("&Exit", 420, 290, 80, 25)
;$Button_4 = GUICtrlCreateButton("&Done", 165, 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.", 40, 140, 290, 30)
GUICtrlSetFont(-1, 10, 650)
$radio[1] = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20)
$radio[2] = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20)
GUISetState()

$Child_[2] = GUICreate("", 508, 238, 1, 1, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main)
$Label_1 = GuiCtrlCreateLabel("Child 2.", 40, 140, 290, 30)
GUICtrlSetFont(-1, 10, 650)
$radio[3] = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20)
$radio[4] = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20)
GUISetState(@SW_HIDE)

$Child_[3] = GUICreate("", 508, 238, 1, 1, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main)
$Label_1 = GuiCtrlCreateLabel("Child 3.", 40, 140, 290, 30)
GUICtrlSetFont(-1, 10, 650)
$radio[5] = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20)
$radio[6] = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20)
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, 140, 290, 30)
GUICtrlSetFont(-1, 10, 650)
$radio[7] = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20)
$radio[8] = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20)
GUISetState(@SW_HIDE)

$Child_[5] = GUICreate("", 508, 238, 1, 1, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main)
$Label_1 = GuiCtrlCreateLabel("Child 5.", 40, 140, 290, 30)
GUICtrlSetFont(-1, 10, 650)
$radio[9] = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20)
$radio[10] = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20)
GUISetState(@SW_HIDE)


While 1
    $msg = GUIGetMsg()

    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_3
            ExitLoop
        Case $msg = $Button_1
            If GUICtrlRead($Button_1) = "&Done" Then Set_Done()
            Set_Next()
        Case $msg = $Button_2
            Set_Back()
        ;Case $msg = $Button_4
            ;Set_Done()
            ;;;
    EndSelect
WEnd


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

Func Set_Done()
    GUICtrlSetState($Button_1, $GUI_DISABLE)
    GUICtrlSetState($Button_2, $GUI_DISABLE)
for $x = 1 to UBound($radio) -1
    If _IsChecked($radio[$x]) Then MsgBox(0x0,"#" & $x, "You selected Radio " & $x, 2)
    Next
EndFunc

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])
            If $x = ($children - 1) Then
                GUICtrlSetData($Button_1, "&Done")
                ;GUICtrlSetState($Button_2, $GUI_DISABLE)
            Else
                GUICtrlSetState($Button_2, $GUI_ENABLE)
            EndIf
            Return
        EndIf
    Next

EndFunc   ;==>Set_Next

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])
            If $x = 2 Then
                GUICtrlSetState($Button_2, $GUI_DISABLE)
            Else
                GUICtrlSetData($Button_1, "&Next >")
                GUICtrlSetState($Button_1, $GUI_ENABLE)
            EndIf
            Return
        EndIf
    Next

EndFunc   ;==>Set_Back

Func _IsChecked($control)
    Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED
EndFunc   ;==>_IsChecked

BTW I did not and will not post Autioit 1-2-3 code

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

I wish this would actually work like your AutoIt 1-2-3...If you press back...Next is disabled. and so is Back. ....Thanks anyway...I guess

I dont need radios on it...I gave up on that project because no one would help and I didnt know how.

Edited by Swift
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...