MathGroup Archive 2011

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

Search the Archive

Re: Making a table with unlinked sliders

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115642] Re: Making a table with unlinked sliders
  • From: Gabriel Landi <gtlandi at gmail.com>
  • Date: Mon, 17 Jan 2011 05:38:52 -0500 (EST)

They talk about this on the Dynamic tutorial.
You gotta replace your code with:

Table[With[{j = j}, Slider[Dynamic[Subscript[x, j]]]], {j, 1, 10}]

Has to do with Dynamic having HoldFirst attribute.

Cheers,

Gabriel

On Sun, Jan 16, 2011 at 8:55 AM, Just A Stranger <
forpeopleidontknow at gmail.com> wrote:

> Hi,
>
> I was wondering if anyone could tell me why this code doesn't work. I'm
> trying to make a list of sliders, each of which controls a different
> variable x_i (where i is an indice in a 1D table).
>
> I thought the code below would work, but it turns out it only half works.
> It
> makes a list of sliders, but for some reason that I can't discern, all of
> those sliders are linked (they all move together). I can't figure out why
> this is. (Maybe it has to do with the subtle issues that arise from Dynamic
> working in the front-end? )
>
> In[0]: Set[#, 0] & /@ Table[Subscript[x, j], {j, 0, 10}];
>        Table[Slider[Dynamic[Subscript[x, j]]], {j, 1, 10}];
>
>


  • Prev by Date: Re: avoiding non-machine numbers
  • Next by Date: one more // Re: Apply or Map on some parts of lists - help
  • Previous by thread: Re: Making a table with unlinked sliders
  • Next by thread: Re: Making a table with unlinked sliders