Re: DynamicModule causing problems with Manipulate setter bar

*To*: mathgroup at smc.vnet.net*Subject*: [mg102795] Re: DynamicModule causing problems with Manipulate setter bar*From*: dh <dh at metrohm.com>*Date*: Thu, 27 Aug 2009 06:36:14 -0400 (EDT)*References*: <h7372a$b2t$1@smc.vnet.net>

Hi Porscha, "m" and "x" in TraditionalForm[Cos[m Pi x] are used as characters not as variables, you must put them in quotes. Otherwise you see the localized version of the character name. Why the highlighting disappears inside DynamicModule is beyond me. Daniel Porscha Louise McRobbie wrote: > Hello, > > I often have multiple Manipulate commands in a single file, and to > avoid them interfering I always wrap them with a DynamicModule. > > The following Manipulate is the basic idea of what I want: > > Manipulate[ > Plot[ffun[y, m1], {y, -1, 1}, Filling -> Axis, > PlotRange -> {{-1, 1}, {-1.1, 1.1}}], > > {{ffun, f1, > "\!\(\*SubscriptBox[\"f\", \"m\"]\)(x)"}, {f1 -> > TraditionalForm[Sin[m Pi x]], f2 -> TraditionalForm[Cos[m Pi x]]}}, > {{m1, 0, "m"}, 0, 3, 1}, > > Initialization :> { (f1[yy_, mm_] := Sin[mm Pi yy]), (f2[yy_, mm_] := > Cos[mm Pi yy])}] > > However, I've noticed the following two problems when trying to wrap > the above with DynamicModule: > > 1. If I place {f1,f2} inside DynamicModule, the graph seems fine but > the blue highlighter color on the setter bar for fm(x) has disappeared. > > DynamicModule[{f1, f2}, > > Manipulate[ > Plot[ffun[y, m1], {y, -1, 1}, Filling -> Axis, > PlotRange -> {{-1, 1}, {-1.1, 1.1}}], > > {{ffun, f1, > "\!\(\*SubscriptBox[\"f\", \"m\"]\)(x)"}, {f1 -> > TraditionalForm[Sin[m Pi x]], > f2 -> TraditionalForm[Cos[m Pi x]]}}, > {{m1, 0, "m"}, 0, 3, 1}, > > Initialization :> { (f1[yy_, mm_] := Sin[mm Pi yy]), (f2[yy_, mm_] := > Cos[mm Pi yy])}]] > > 2. If I place {f1,f2,m,x} inside DynamicModule, the graph seems fine > but now the labels for "m" and "x" read "$$m" and "$$x" (in addition > to the blue highlighting being gone). > > DynamicModule[{f1, f2, m, x}, > > Manipulate[ > Plot[ffun[y, m1], {y, -1, 1}, Filling -> Axis, > PlotRange -> {{-1, 1}, {-1.1, 1.1}}], > > {{ffun, f1, > "\!\(\*SubscriptBox[\"f\", \"m\"]\)(x)"}, {f1 -> > TraditionalForm[Sin[m Pi x]], > f2 -> TraditionalForm[Cos[m Pi x]]}}, > {{m1, 0, "m"}, 0, 3, 1}, > > Initialization :> { (f1[yy_, mm_] := Sin[mm Pi yy]), (f2[yy_, mm_] := > Cos[mm Pi yy])}]] > > How can I localize the variables f1,f2,m,x but still have the labels > look how I want them to? > > Many thanks! > Porscha > > >