I'm trying to build an ExampleData browser, so that the "collection"/"type" is selectable in a drop down menu, and the "name" is selectable in another drop down menu. What I have so far:

DynamicModule[ {},
Panel[
Column[{
(PopupMenu[Dynamic[h], Last[##] & /@ ExampleData[#]]) & /@
Dynamic[q],
ExampleData[Dynamic[q], Dynamic[h]]
}]
]
]


...Only produces a nice error message:

Why isn't ExampleData evaluating the dynamic value of q & h? (i.e. ExampleData["TestImage", "Aerial2"])

• Dynamic@ExampleData[{q, h}] (instead of ExampleData[Dynamic[q], Dynamic[h]]) works (but ... slow ) – kglr Jul 11 '14 at 20:05
• Suggest as an answer? (with an explanation as to why this fixes the problem?) – Alexander Riccio Jul 12 '14 at 0:36
• suggestion in my comment fixes one of the problems. As to why it does (1) ExampleData[a,b] should be ExampleData[{a, b}], (2) the error message "Dynamic[q] is not a known collection for ExampleData" gives a hint: Dynamic[q] and q are quite different objects. The more important issue is updating h properly when q is changed so that the {q,h} combination is a valid input for ExampleData so that ExampleData is not called with an input like {"AerialImage", "CatFur"}:). Maybe someone else can come up with a complete solution while I explore some approaches. – kglr Jul 12 '14 at 1:18

Dynamic is sometimes too aggressive for some purposes. You need to make sure Dynamic updates only when you are ready for new results. Besides, to ensure that Dynamic will have enough time to process your request it is sometimes a good idea to use SynchronousUpdating option. In the solotuion below you will see that instead of calculating the menu options inside the Popup Dynamic, these are calculated in the external Dynamic where the SynchronousUpdating option will avoid aborted calculations.

DynamicModule[{readyQ = False, menu2Options = {}, q = "", h = "",
optCnt = 0, pSize = {400, 100}},
Panel@
Column[{
(q = #;
optCnt++;
) &]
, ExampleData[]
, Style["Select One", Red]
]
,
Dynamic[
Refresh[
menu2Options = If[q === "", {}, Last[##] & /@ ExampleData[q]];
Column[{
(h = #;
optCnt++;
) &
]
, Style["Select One", Red]
]
,
"No options found."
]
,
Pane[