I am working on a bible program now, and I have the dropdown listing the books of the bible. Then I have the chapters that are supposed to show based on what book is chosen in the dropdown. Problem is, is it always shows the first chapter no matter what I choose. Like Genesis has 50 chapters, and Exodus has 22 I think.... Anyway, no matter which one I choose, it keeps the 50 chapters and doesn't switch. I have brainfried myself, so decided to ask for help. Thank you.
Code: Select all
; ************ READ TEXT FILE TO DETERMINE WHAT BIBLE TO LOAD AT START***************
IniRead, keyFilename, settings.txt, ActiveBook, Filename, %A_Space%
If !(keyFilename) {
IniWrite, 1-Genesis, settings.txt, ActiveBook, filename
keyFilename := "Bible"
}
global iniPath := keyFilename . ".ini"
global DestFolder := A_ScriptDir
Gui, add, Text, x10 y4, Chapter
Gui, add, ListView, vchapter NoSortHdr -Hdr AltSubmit hwndhchapter x10 y30 w100 h450, |
Gui, add, Text, x100 y4, Verses
Gui, add, ListView, vListChapVs NoSortHdr -Hdr AltSubmit hwndhverses gListChapVs x130 y30 w550 h450, |
Gui, Show, w700 h500, %Title% - %Version%
DefaultValue := 1
loop, Files, Books\*.ini
{
SplitPath, A_LoopFileName,,,, FileName
List .= FileName "|"
If (A_LoopFileName = iniPath)
DefaultValue := A_Index
}
List := RTrim(List, "|")
; List := StrReplace(List, "|", "||",, 1) ;default item
; ******************************* SET THE SIZE IN HEIGHT OF THE DROPDOWN MENU **********************************************
Gui, Add, DropDownList, x2 y5 w132 vmyDropDownList gPresetChange hwndhcbx choose%DefaultValue%, % List
PostMessage, 0x153, -1, 17,, ahk_id %hcbx%; Set height of selection field.
; ******************************* SET THE SIZE IN HEIGHT OF THE DROPDOWN MENU **********************************************
ListChapVs:
if (myDropDownList = 1-Genesis) {
LV_ModifyCol(1, "AutoHdr")
Gui, ListView, chapter
Loop, Read, Chapters\GenesisChapters.txt
LV_Add("",A_LoopReadLine)
LV_ModifyCol(1, LV_GetCount()>10 ? 79:96)
LV_ModifyCol(1, "AutoHdr")
Gui, ListView, ListChapVs
Loop, Read, Verses\GenChap1.txt
LV_Add("",A_LoopReadLine)
Return
}
if (myDropDownList = 2-Exodus) {
LV_ModifyCol(1, "AutoHdr")
Gui, ListView, chapter
Loop, Read, Chapters\ExodusChapters.txt
LV_Add("",A_LoopReadLine)
LV_ModifyCol(1, LV_GetCount()>10 ? 79:96)
LV_ModifyCol(1, "AutoHdr")
Gui, ListView, ListChapVs
Loop, Read, Verses\ExoChap1.txt
LV_Add("",A_LoopReadLine)
Return
}
PresetChange:
Gui, Submit, NoHide
text := myDropDownList
GuiControl, +AltSubmit, myDropDownList
Gui, Submit, NoHide
GuiControl, -AltSubmit, myDropDownList
CurrentFileName = % text
IniWrite, % text, settings.txt, ActiveBook, Filename
Gui, Submit, NoHide
Reload
return
GuiEscape:
GuiClose:
GuiClose2:
ExitApp
Blessings