I have a Gui which contains a drop-down list populated from reading a textfile of client names.
Code: Select all
Gui, 1:Add, DropDownList, x120 y230 w300 vClient gDDLChoice, %ClientList%
This works fine. One of the items on the DDL is "Add new client" which triggers "DDLChoice" and opens a new Gui with a text box to add the new client's name. I've put the code below. After clicking the button on Gui 2, the script will append the new client name to the end of the text file (F1). Then I have AddNewClient re-read the text file into the ClientList array, sort it, and re-open the Gui 1: (which contains the DDL of client names).
My problem is that I can't figure out how to have the ClientList updated in the DDL when Gui 1: is re-shown.
Code: Select all
DDLChoice:
Gui, 1:Submit
if (Client="Add new client"){
Gui, 2:Add, Text,,Client Name:
Gui, 2:Add, Edit, w200 vNewClient
Gui, 2:Add, Button,gAddNewClient,Add
Gui, 2:Show, w300 h300
}
else
Gui, 1:Show
Return
AddNewClient:
Gui, 2:Submit
FileAppend, %NewClient%`r`n,%F1%
Loop, Read, %F1%
ClientList .= A_LoopReadLine "|"
Sort, ClientList
Gui, 1:show
Return
Any help would be most appreciated. I've scoured the forum with no result that will let me do this.