I'm trying to create a user interface in Mathematica; the user will enter specified information, it will be processed, and then data will be inserted into a MySQL database. The pieces work independently but when I put them together, odd things happen.
So for example, this works:
Module[{ss, flist},
flist = {"f1", "f2", "f3"};
ss = First[flist];
CreateWindow[DialogNotebook[{
PopupMenu[Dynamic[ss], flist],
ChoiceButtons[{"Enter", "Cancel"}, {DialogReturn[{Print["ss: ", ss]}]}]}]];
];
But the following, which seems to be substantially identical, does not. Specifically, if the user doesn't select something new from the popup menus, the variables never get initialized.
Module[{ss, flist, ci, clist},
flist = {"f1", "f2", "f3"};
clist = {"c1", "c2", "c3"};
ss = First[flist];
ci = First[clist];
CreateWindow[DialogNotebook[{
PopupMenu[Dynamic[ss], flist],
PopupMenu[Dynamic[ci], clist],
ChoiceButtons[{"Enter", "Cancel"}, {DialogReturn[{Print["ss: ", ss, ". ci: ", ci]}]}]}]];
];
What am I missing?