Background: I have several PopupViews of which the loadtime adds to the startup time of a program. To improve the perceived performance I want to defer the loading of the PopupView to the moment that they are actually used. I thought about this:
Clear[filelist];
Clear[obj];
filelist = {};
Dynamic@PopupView[filelist, Dynamic[obj, (obj = #;) &],
Button["Edit", filelist = {1, 2, 3}, ImageSize -> 80]]
The idea works but not as expected, the popupview is not displayed correctly until filelist is loaded. I want to correct this or find an alternative way to set this up.
Question: How can I defer the loading of a PopupView control until it is used ?

If[filelist==={}, #, PopupView[filelist, ...]]&[Button...]can fix the layout, but you would still need to clickEdittwice before the popup appears – Rojo Jun 25 '12 at 14:11PopupViewwhose list elements take long to execute, and you want them to only execute when you open thePopupView? – Rojo Jun 25 '12 at 14:30