Jump to content

test with no luck


eMac
 Share

Recommended Posts

I've tried several ways, but since i'm learning Autoit, i'm not that great into it.

I tried creating an input box, and I have a Next > button, and a checkbox with "Agree to Terms"

How can I make next button disabled until checkbox = checked, then you can click next.

Codename: Source ProgrammerWhat Is Codename: Source? A community designed operating system based off of the Windows OS. Source brings the ideas of the community to life as each user brings his or her own ideas into the development of this project.
Link to comment
Share on other sites

#include <GuiConstants.au3>
#NoTrayIcon; Disables tray icon

Global $Img_Path = @SystemDir & "\Setup.bmp"

$Main_GUI = GuiCreate("" & $title, 400, 450)
    GuiCtrlCreatePic("logo.gif",0,0,0,0)
        _GuiCtrlCreateSeperator(0, 2, 410, 3, 396)

$Back_Button = GUICtrlCreateButton("<< Back", 170, 420, 60)
    GUICtrlSetState(-1, $GUI_DISABLE)
$Next_Button = GUICtrlCreateButton("Next >>", 240, 420, 60)
$Exit_Button = GUICtrlCreateButton("Exit", 325, 420, 60)

$step1 = GuiCreate("Child window 1", 400, 300, 5, 5, $WS_POPUP)

$LabelGui1 = GUICtrlCreatePic($Img_Path, 2, 2, 160, 250, $SS_SUNKEN, $WS_EX_STATICEDGE+$WS_EX_CLIENTEDGE)
    GUICtrlCreateLabel("" & $title, 5, 85, 390, 150)
        GUICtrlSetFont(-1, 8.5, 800, 0, $font)

    GUICtrlCreateLabel("Hello " & @UserName & _
    ", thank you for selecting us for your modification selection.", 5, 115, 380, 150)
        GUICtrlSetFont(-1, 8.5, 400, 0, $font)
    
    GUICtrlCreateLabel("You are about to install the " & $mod & " mod on your site. Please review each step carefully before proceeding with the next step.", 5, 160, 380, 150)
        GUICtrlSetFont(-1, 8.5, 400, 0, $font)
    
    GUICtrlCreateLabel("We are not responsible for issues or errors that occur due to improper installation. It is recommended that all data be backed up in a safe location to prevent data loss before continuing with this wizard.", 5, 220, 380, 150)
        GUICtrlSetFont(-1, 8.5, 800, 0, $font)


$step2 = GuiCreate("TOU", 400, 260, 5, 5, $WS_POPUP)
    GUICtrlCreateLabel("Terms of Use Agreement", 5, 85, 390, 150)
        GUICtrlSetFont(-1, 8.5, 800, 0, $font)

$step3 = GuiCreate("step3", 400, 260, 5, 5, $WS_POPUP)
$LabelGui3 = GUICtrlCreateEdit("content", 5, 20, 180, 220)

#CS --------------------------------------------------------------------
            DllCall 'user32.dll'
#CE --------------------------------------------------------------------
DllCall("user32.dll", "int", "SetParent", "hwnd", $step1, "hwnd", $Main_GUI)
DllCall("user32.dll", "int", "SetParent", "hwnd", $step2, "hwnd", $Main_GUI)
DllCall("user32.dll", "int", "SetParent", "hwnd", $step3, "hwnd", $Main_GUI)

GUISetState(@SW_SHOW, $Main_GUI)
GUISetState(@SW_SHOW, $step1)

While 1
    $Msg = GUIGetMsg(1)
    Switch $Msg[0]
        Case $GUI_EVENT_CLOSE, $Exit_Button
            If $Msg[0] = $Exit_Button And Not _WinIsVisible($step1) Then
                $Ask = _MsgBox(256+52, "Attention", "Are you sure you want to exit the Wizard now?", $Msg[1])
                If $Ask <> 6 Then ContinueLoop
            EndIf
            
            If $Msg[1] = $Main_GUI Then Exit
        Case $Next_Button
            GUICtrlSetState($Back_Button, $GUI_ENABLE)
            
            Local $CurrentHandle = 0
            Local $NextHandle = 0
            
            Select
                Case _WinIsVisible($step1)
                    $CurrentHandle = $step1
                    $NextHandle = $step2
                Case _WinIsVisible($step2)
                    $CurrentHandle = $step2
                    $NextHandle = $step3
                    GUICtrlSetState($Next_Button, $GUI_DISABLE)
            EndSelect
            
            If $CurrentHandle <> 0 Then
                GUISetState(@SW_HIDE, $CurrentHandle)
                GUISetState(@SW_SHOW, $NextHandle)
            EndIf
            
            WinActivate($Main_GUI)
        Case $Back_Button
            GUICtrlSetState($Next_Button, $GUI_ENABLE)
            
            Local $CurrentHandle = 0
            Local $BackHandle = 0
            
            Select
                Case _WinIsVisible($step3)
                    $CurrentHandle = $step3
                    $BackHandle = $step2
                Case _WinIsVisible($step2)
                    $CurrentHandle = $step2
                    $BackHandle = $step1
                    GUICtrlSetState($Back_Button, $GUI_DISABLE)
            EndSelect
            
            If $CurrentHandle <> 0 Then
                GUISetState(@SW_HIDE, $CurrentHandle)
                GUISetState(@SW_SHOW, $BackHandle)
            EndIf
            
            WinActivate($Main_GUI)
    EndSwitch
WEnd

Func _GuiCtrlCreateSeperator($Direction, $Left, $Top, $Width=3, $Lenght=25)
    Switch $Direction
        Case 0
            GUICtrlCreateLabel("", $Left, $Top, $Lenght, $Width, $SS_SUNKEN)
        Case 1
            GUICtrlCreateLabel("", $Left, $Top, $Width, $Lenght, $SS_SUNKEN)
    EndSwitch
EndFunc

Func _MsgBox($MsgBoxType, $MsgBoxTitle, $MsgBoxText, $MainGUI=0)
    Local $iRet = DllCall ("user32.dll", "int", "MessageBox", _
            "hwnd", $MainGUI, _
            "str", $MsgBoxText , _
            "str", $MsgBoxTitle, _
            "int", $MsgBoxType)
    Return $iRet[0]
EndFunc

Func _WinIsVisible($hWnd)
    Return BitAND(WinGetState($hWnd), 2)
EndFunc

Post the code you have

so we can only add desired part and not write whole script from scratch for you.

For AutoIt GUI use great Koda tool.

Edited by eMac
Codename: Source ProgrammerWhat Is Codename: Source? A community designed operating system based off of the Windows OS. Source brings the ideas of the community to life as each user brings his or her own ideas into the development of this project.
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...