I'm trying to dynamically change the number of Popup menus and Grid cells in Manipulate and connect the chosen values to the displayed Grid.
I have gotten as far as this:
Manipulate[Grid[Table[v, {x, h}, {y, w}], Frame -> All],
{{h, 2}, 1, 5, 1}, {{w, 2}, 1, 5, 1},
Dynamic@Panel[
Grid[Outer[PopupMenu[Dynamic[v], {1, 2, 3, 4}] &, Range[h],
Range[w]]]]]
I can change the number of popup menus and the Grid cells change as well. However, each popup menu should correspond to a Grid cell and selection a value should update the value in the Grid cell, e.g. top left popup menu should update the value in the top left Grid cell.
But the problem is, that every popup menu needs its own Dynamic variable. With my approach, the value is updated in the entire Grid and the popup menus behave as one.
I hope it became clear. Any ideas how to change the code to make this work?