2

Just trying to build a dialog window for picking items from the list. However it doesn't work as expected. Here is the simplified example

CreateDialog[
 Table[Button["press", DialogReturn[ret = i]], {i, 1, 3}]
 ]

then

In[10]: ret
Out[10]: i

I expected to return the number I clicked. Could you help me to solve this issue/feature? :)

Kirill Vasin
  • 1,235
  • 12
  • 14

1 Answers1

2

This will work as you expect:

CreateDialog[
 Table[With[{i = i}, Button["press", DialogReturn[ret = i]]], {i, 1, 
   3}]]
Rolf Mertig
  • 17,172
  • 1
  • 45
  • 76