MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

How to scope PopupMenu values in a DynamicModule?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107390] How to scope PopupMenu values in a DynamicModule?
  • From: asdf qwerty <bradc355113 at yahoo.com>
  • Date: Thu, 11 Feb 2010 06:53:22 -0500 (EST)

Why does this work:

DynamicModule[{foo}, PopupMenu[Dynamic[foo], {bar, baz}]]

but this doesn't:

DynamicModule[{foo, bar, baz}, PopupMenu[Dynamic[foo], {bar, baz}]]

?

In the second example, the PopupMenu display always looks blank. Are
the two occurrences of bar and baz in different scopes or something?

I ran into this because I'm trying to avoid possible symbol clashes
for my PopupMenu values, for the reason described near the beginning
of the "Advanced Dynamic Functionality" tutorial ("a different kernel
session may coincidentally share the same localized variable names").
I'd like to use symbols for the PopupMenu values rather than say,
integers, because it makes the code easier to read.


  • Prev by Date: Re: Clip[DirectedInfinity[1]] remains unevaluated?
  • Next by Date: Define an antisymmetric function
  • Previous by thread: Re: manipulate plot
  • Next by thread: Re: How to scope PopupMenu values in a DynamicModule?