I've got a dialog box that contains a Combo box. The Combo box gets its values from an INI file, and I wanted to build a tab where I can add values to the list in the INI file. So far, so good, the macro can do that.
The next thing that I want to do is to display the new list in the combo box after the ADD.
I'm not having any luck. If I don't close the dialog, the combo box is never refreshed. If I close the dialog, and then re-open it, then the result depends on how I try to re-open it:
if the Create Dialog block is re-run as part of the restart, I get a nondescript error, it probably is complaining about the Dialog1 object already having been created.
if the Create Dialog block is skipped, and I just try to Show> again, then the combo boxes don't include the new values.
Line 42, MessageModal, seems to point to the problem. What can I do?
Tx,
George
Here's some abbreviated code to set it up:
To run the following code, you need a file, c:\ftploader.ini
and in it, you need this:
Code: Select all
[Clients]
//separate clients with pound sign #
clientlist=apple#baker#charlie
Then, here is MS code:
Code: Select all
VAREXPLICIT=0
//Initialize Variables
Let>delmsg=
// move this create dialog block to immediately after SHOW,
// and you get a different error
Dialog>Dialog1
Caption=Refresh a combo box
Width=545
Height=210
Top=156
Left=28
TabBook=mytabs,32,10,20,15,1
TabPage=Send File
Label=Choose a name,32,26
ComboBox=Client_list,32,40,200,clist
TabPage=Download Client Files
Label=Use the url below to download client files,32,8
Label=http://url.com/files,32,40
TabPage=Add Name
Label=Use this tab to add a name to the dropdown box,32,8
Label=Enter a client name,32,26
Edit=msEdit4,32,40,200,
Label=Review the client list,32,74
ComboBox=Clients4,32,90,200,clist
Button=Add,244,40,75,25,4
EndTabBook
EndDialog>Dialog1
Label>DialogStart
Let>clist1=
ReadIniFile>c:\ftploader.ini,Clients,clientlist,clist0
StringReplace>clist0,#,%CRLF%,clist
MessageModal>clist
Show>Dialog1
Label>ActionLoop
GetDialogAction>Dialog1,r
if>r=3,Send
if>r=4,Add
if>r=5,Edit
if>r=6,Delete
if>r=2,xit
if>r=99,Restart
Goto>ActionLoop
Label>xit
exit>
SRT>Restart
CloseDialog>Dialog1
Wait>5
Goto>DialogStart
END>Restart
SRT>Send
ResetDialogAction>Dialog1
END>Send
SRT>Add
StringReplace>%Dialog1.msEdit4%, ,,new_item
If>Length(%new_item%)=0
ResetDialogAction>Dialog1
Endif>
Concat>clist0,#
Concat>clist0,%Dialog1.msEdit4%
'MessageModal>clist0
EditIniFile>c:\ftploader.ini,Clients,clientlist,clist0
Let>r=99
END>Add