The list box allowed me to toggle the selection of each line at a time, without the use of Shift or Control.
Is there a way to do this with the options or must a function be created for it?
ListBox:
Code: Select all
#Requires AutoHotkey v2.0
deleter := Gui("","File Deleter")
demoArray := ["File 1","File 2","File 3"]
button_DeleteFiles := deleter.Add("Button", "Default x25 y5 w70 h30", "Delete Files")
button_DeleteFiles.OnEvent("Click", delete_Old_Files.Bind())
edit_captured_Number := deleter.Add("Edit", "vcaptured_Number ReadOnly x100 y7 w375 h25", "This would be the directory.")
edit_LB_Box := deleter.Add("ListBox", "voutput_Box x25 y40 w450 h430 T1 8", demoArray)
edit_deletion_Count := deleter.Add("Edit", "vdeletion_Count ReadOnly center x25 y475 w450 h20", "Files deleted:")
deleter.OnEvent("Close", close_the_Deleter)
deleter.OnEvent("Escape", close_the_Deleter)
deleter.Show("xCenter yCenter w500 h500")
for (select_File in demoArray) {
edit_LB_Box.Choose(select_File)
}
return
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; Function to delete captured files.
delete_Old_Files(*) {
global
subbed_GUI := deleter.Submit()
try {
for (file_to_Delete in subbed_GUI.output_Box) {
MsgBox(file_to_Delete " would have been deleted.")
}
}
return
}
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; If close button is hit on GUI.
; If escape key is hit on GUI.
close_the_Deleter(*) {
deleter.Destroy()
Exit()
}
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
Code: Select all
#Requires AutoHotkey v2.0
deleter := Gui("","File Deleter")
demoArray := ["File 1","File 2","File 3"]
button_DeleteFiles := deleter.Add("Button", "Default x25 y5 w70 h30", "Delete Files")
button_DeleteFiles.OnEvent("Click", delete_Old_Files.Bind())
edit_captured_Number := deleter.Add("Edit", "vcaptured_Number ReadOnly x100 y7 w375 h25", "This would be the directory.")
edit_LV_Box := deleter.Add("ListView", "+E0x8 +E0x4 +E0x3 x25 y40 w450 h430", ["File Name", "Creation Date"])
; edit_LV_Box.OnEvent("Click", lvSelectorSwap) <-- would be my fuction to mimic behavior.
edit_deletion_Count := deleter.Add("Edit", "vdeletion_Count ReadOnly center x25 y475 w450 h20", "Files deleted:")
deleter.OnEvent("Close", close_the_Deleter)
deleter.OnEvent("Escape", close_the_Deleter)
edit_LV_Box.ModifyCol(1, 300)
edit_LV_Box.Add("+Select","File 1","Created Now")
edit_LV_Box.Add("+Select","File 2","Created Now")
edit_LV_Box.Add("+Select","File 3","Created Now")
deleter.Show("xCenter yCenter w500 h500")
edit_LV_Box.Modify(0, "Select")
edit_LV_Box.Focus()
return
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; Function to delete captured files.
delete_Old_Files(*) {
global
RowNumber := 0
Loop {
RowNumber := edit_LV_Box.GetNext(RowNumber)
if (!RowNumber) {
break
}
MsgBox(edit_LV_Box.GetText(RowNumber) " wouldve been deleted.")
}
ExitApp()
return
}
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; If close button is hit on GUI.
; If escape key is hit on GUI.
close_the_Deleter(*) {
deleter.Destroy()
Exit()
}
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;