Message Boards Message Boards

Why doesn't Manipulate have InheritScope as an option? (i.e, a wormhole)

Posted 8 years ago

This is just a question about WL design and Dynamic scoping. I have a work-around--I am just curious and trying to teach myself something about wormholes.

I am assuming that Manipulate wraps its guts inside a DynamicModule--or wraps DynamicModule around its guts.

Suppose I'd like to to let one of the control variables slip through a wormhole to an enclosing DynamicModule.

Here is a prototype that doesn't work:

DynamicModule[{manipulateLocation},
 GraphicsRow[
  {
   Manipulate[
    Graphics[{LightBlue, Disk[]}],
    {{manipulateLocation, {0, 0}}, Locator},
    Paneled -> False, InheritScope -> True], (*InheritScope is not an Option to Manipulate, it is just illustrative here*)
   Dynamic[
    ContourPlot[
     manipulateLocation.{x - y^2, Cos[x y]}, {x, -Pi, Pi}, {y, -Pi, 
      Pi}]],
   Dynamic[
    Plot3D[manipulateLocation.{x - y^2, Cos[x y]}, {x, -Pi, 
      Pi}, {y, -Pi, Pi}]]
   },
  ImageSize -> Large
  ]
 ]

Again, there is a simple workaround. I am just curious about why the option isn't or shouldn't be there.

POSTED BY: W. Craig Carter

P.S.

A friend suggested that it is more aesthetically pleasing to wrap the above in a Panel:

Panel@DynamicModule[{dynamicLocation},
  GraphicsRow[
   {
    Manipulate[
     dynamicLocation = manipulateLocation;
     Framed@Graphics[{LightBlue, Disk[]}],
     {{manipulateLocation, {0, 0}}, Locator},
     Paneled -> False],
    Dynamic[
     ContourPlot[
      dynamicLocation.{x - y^2, Cos[x y]}, {x, -Pi, Pi}, {y, -Pi, 
       Pi}]],
    Dynamic[
     Plot3D[dynamicLocation.{x - y^2, Cos[x y]}, {x, -Pi, 
       Pi}, {y, -Pi, Pi}]]
    },
   ImageSize -> Large
   ]
  ]
POSTED BY: W. Craig Carter
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract