Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Localizing Large Numbers of Variables in a DynamicModule:

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85714] Re: [mg85691] Localizing Large Numbers of Variables in a DynamicModule:
  • From: Carl Woll <carlw at wolfram.com>
  • Date: Wed, 20 Feb 2008 06:51:04 -0500 (EST)
  • References: <200802190701.CAA27974@smc.vnet.net>

Ron Monson wrote:

>I'm wondering if anyone can see a shorter way of  localising a large number of variables within a DynamicModule? For example,  instead of 
>DynamicModule[{x1,x2,x3,x4,x5},
>oo[x1,x2,x3,x4,x5];
>oo[x1,x2,x3,x4,x5]
>;
>something with an idiom along the lines of 
>args={x1,x2,x3,x4,x5};
>DynamicModule[args,
>oo[args];
>oo[args]
>
>The motivation for this is that in constructing a complex  interface the number of varfiables and functions may get quite large and further,  these variables may also need to be accessed in another function that is nested  more deeply . For example, function foo may call other functions which in  turn call other functions ... until finally the bottom function may need to  access say the variable - x1. Having to  repeatedly pass the entire or selected parts of  the variable space can get unwieldy and impact on the final code's  readability. Thanks.
>  
>
Use With:

With[{args={x1,x2,x3,x4,x5}}, DynamicModule[args, body]]

Carl Woll
Wolfram Reserarch


  • Prev by Date: Re: Multiple data sets with ListPlot and different PointSizes - Mesh
  • Next by Date: Re: Multiple data sets with ListPlot and different PointSizes - Mesh
  • Previous by thread: Localizing Large Numbers of Variables in a DynamicModule:
  • Next by thread: Re: Localizing Large Numbers of Variables in a DynamicModule: