Normally I'm able to dig through tons of post and my slow brain will eventually glean, from everyone's brilliance, the information I need, but I've spent all afternoon in the "Forum" trenches and the Help File and I'm still at a loss.
I have an old Backup/Restore Script I created using AutoIt back in the day and I'm trying to re-write/improve it with all that I've learned from trudging in everyone's footsteps around here. I've got the actual functionality covered, but the GUI is killing me. I've created a checkbox and some radio buttons and I'm trying to disable and enable input options (dropdowns, input, file select, etc...) based on if they are selected or not. In my select case, only the top most listed choice will work. Should I be using onevent instead? What obvious mistake am I making here? (here's most of the GUI minus unnecessary extras)
CODE#include <file.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <array.au3>
$Main = GUICreate("Welcome to the Backup program!", 500, 500)
$group_1 = GUICtrlCreateGroup("Set Backup Locations", 20, 10, 200, 100)
GUIStartGroup()
$location_1 = GUICtrlCreateCheckbox("Default selections", 30, 30, 182, 20)
GUICtrlSetState($location_1, $GUI_CHECKED + $GUI_DISABLE)
$location_2 = GUICtrlCreateCheckbox("Add Locations...", 30, 50, 160, 20)
$AddFile = GUICtrlCreateButton("Add File", 30, 75, 45, 20)
$AddFolder = GUICtrlCreateButton("Add Folder", 80, 75, 60, 20)
GUICtrlSetState($AddFile, $GUI_DISABLE)
GUICtrlSetState($AddFolder, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group
$group_2 = GUICtrlCreateGroup("Set Backup Media", 20, 120, 200, 220)
GUIStartGroup()
$chkFixed = GUICtrlCreateRadio("Backup to Hard Drive", 30, 140, 180, 20)
$fixed = GUICtrlCreateCombo("Hard Drive", 30, 160, 180, 20)
GUICtrlSetState($fixed, $GUI_DISABLE)
$chkCDRom = GUICtrlCreateRadio("Backup to CD Burner", 30, 185, 180, 20)
$CDRom = GUICtrlCreateCombo("CD-Rom Drive", 30, 205, 180, 20)
GUICtrlSetState($CDRom, $GUI_DISABLE)
$chkRemovable = GUICtrlCreateRadio("Backup to Removable Drive", 30, 230, 180, 20)
$Removeable = GUICtrlCreateCombo("Removeable Drive", 30, 250, 180, 20)
GUICtrlSetState($Removeable, $GUI_DISABLE)
$chkNetwork = GUICtrlCreateRadio("Backup to Network Location", 30, 275, 180, 20)
$Network = GUICtrlCreateCombo("Network Drive", 30, 295, 180, 20)
GUICtrlSetState($Network, $GUI_DISABLE)
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group
$group_4 = GUICtrlCreateGroup("Backup List", 230, 10, 260, 470)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE ;X in corner is clicked
;_FileWriteLog($LogFile, "Closed application - X in corner")
;FileClose($LogMe)
Exit
Case $msg = $AddFile
$inputBrowse = FileOpenDialog("Select a file...", "", "All (*.*)", 3)
$YNadd = MsgBox(36, "Verify File", "Are you sure you want to add:"&@CR&@CR&$inputBrowse)
If $YNadd = 6 Then
MsgBox(64, "File Added...", $inputBrowse&@CR&@CR&"...has been added to your backup.")
;_FileWriteLog($LogFile, "Added file =" & $inputBrowse)
Else
MsgBox(48, "No Addition", $inputBrowse&@CR&@CR&"...was NOT added to the backup.")
EndIf
Case $msg = $AddFolder
$inputBrowse = FileSelectFolder("Select a folder...", "")
$YNadd = MsgBox(36, "Verify Folder", "Are you sure you want to add:"&@CR&@CR&$inputBrowse)
If $YNadd = 6 Then
MsgBox(64, "Folder Added...", $inputBrowse&@CR&@CR&"...has been added to your backup.")
;_FileWriteLog($LogFile, "Added folder =" & $inputBrowse)
Else
MsgBox(48, "No Addition", $inputBrowse&@CR&@CR&"...was NOT added to the backup.")
EndIf
Case BitAND(GUICtrlRead($location_2), $GUI_CHECKED)
If Not BitAND(GUICtrlGetState($AddFile), $GUI_ENABLE) Then GUICtrlSetState($AddFile, $GUI_ENABLE)
If Not BitAND(GUICtrlGetState($AddFolder), $GUI_ENABLE) Then GUICtrlSetState($AddFolder, $GUI_ENABLE)
Case BitAND(GUICtrlRead($location_2), $GUI_UNCHECKED)
If Not BitAND(GUICtrlGetState($AddFile), $GUI_DISABLE) Then GUICtrlSetState($AddFile, $GUI_DISABLE)
If Not BitAND(GUICtrlGetState($AddFolder), $GUI_DISABLE) Then GUICtrlSetState($AddFolder, $GUI_DISABLE)
Case BitAND(GUICtrlRead($chkFixed), $GUI_CHECKED)
If Not BitAND(GUICtrlGetState($fixed), $GUI_ENABLE) Then GUICtrlSetState($fixed, $GUI_ENABLE)
Case BitAND(GUICtrlRead($chkFixed), $GUI_UNCHECKED)
If Not BitAND(GUICtrlGetState($fixed), $GUI_DISABLE) Then GUICtrlSetState($fixed, $GUI_DISABLE)
EndSelect
WEnd
...preparing to bow to the forthcoming enlightenment!
(any of which I am truly grateful for)