MathGroup Archive 2010

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

Search the Archive

Re: How to scope PopupMenu values in a DynamicModule?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg107424] Re: How to scope PopupMenu values in a DynamicModule?
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Fri, 12 Feb 2010 04:42:33 -0500 (EST)
  • References: <hl0r15$tq$1@smc.vnet.net>

If you want to have labels in the pop-up for better readability why
don't you use the

PopupMenu[x,{Subscript[val, 1]->Subscript[lbl, 1],Subscript[val, 2]-
>Subscript[lbl, 2],\[Ellipsis]}]

syntax version of PopupMenu?

Cheers -- Sjoerd

On Feb 11, 1:52 pm, asdf qwerty <bradc355... at yahoo.com> wrote:
> 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: How to lay out a grid of plots with frame labels, but no spaces
  • Next by Date: Re: Define an antisymmetric function
  • Previous by thread: How to scope PopupMenu values in a DynamicModule?
  • Next by thread: Re: How to scope PopupMenu values in a DynamicModule?