# What is the equivalent of a prototypical Manipulate in lower level functions?

Background: In the Mathematica tutorial 'Dynamic Interactivity' I read that there is a way of developing GUIs in Mathematica that do not use Manipulate. I want to investigate this further.

Question: What is the equivalent of Manipulate[i,{i,1,5,1}] in 'lower-level' Mathematica functions?

-

Start from

{Slider[Dynamic[x], {1, 5, 1}], Dynamic[x]}


Next localize control variable:

DynamicModule[{x}, {Slider[Dynamic[x], {1, 5, 1}], Dynamic[x]}]


Panel@DynamicModule[{x},  Column[{Slider[Dynamic[x],
{1, 5, 1}], Panel[Dynamic[x], ImageSize -> 200]}]]


Panel@DynamicModule[{x},   Column[{Row[{"x", Spacer[10],
Animator[Dynamic[x], {1, 5, 1}, AnimationRunning -> False,
ImageSize -> Small]}], Panel[Dynamic[x], ImageSize -> 235]}]]


-
Good idea to build-up your answer like that. – Sjoerd C. de Vries Apr 29 '12 at 8:20
+1, though there is one thing it's missing: the Bookmarks/Autorun icon from the upper right corner. I have no idea how to replicate that. – István Zachar Apr 29 '12 at 13:05
+1 I guess replicating SaveDefinitions and "Paste Snapshot" would be difficult as well? – Ajasja May 24 '12 at 19:34

I realize this isn't what you meant by "lower level" but nevertheless viewing the Cell Expression for various kinds of output can be interesting and informative. Based on observing that expression it is possible to craft this:

DynamicBox[
ManipulateManipulateBoxes[1, StandardForm,
"Variables" :> {a$$= 0}, "ControllerVariables" :> {Hold[a$$, 0]},
"OtherVariables" :> {},
"Body" :> Plot[Sin[x (1 + a$$x)], {x, 0, 6}], "Specifications" :> {{a$$, 0, 2}},
"Options" :> {},
"DefaultOptions" :> {}
]
] // ToExpression


Of course direct use like this isn't advisable because I have stripped out all localization etc. for this example that is normally generated automatically.

As a further point of curiosity, if you want to see the very low level Box expressions, leave off DynamicBox and ToExpression from the example above to reveal this:

PaneBox[PanelBox[
DynamicWrapperBox[
GridBox[{{ItemBox[
ItemBox[StyleBox[
GridBox[{{TagBox["a", HoldForm],
TagBox[PaneBox[
DynamicModuleBox[{Typesetopen$$= False, Typesetpaused$$ = 0, Typesetrate$$= Automatic, Typesetdir$$ = Forward},
StyleBox[
DynamicBox[
FEPrivateFrontEndResource["FEExpressions",
"Manipulator04"][Dynamic[a$$], Dynamic[a$$], {0, 2}, Medium, Small, Automatic,
True, Automatic, False, True, True, All, False, {},
Dynamic[Typesetopen$$], Dynamic[Typesetpaused$$],
Dynamic[Typesetrate$$], Dynamic[Typesetdir$$]]],
DynamicUpdating -> True],
DynamicModuleValues -> Automatic], ImageMargins -> 0,
BaselinePosition -> Baseline],
ManipulateInterpretManipulator[
Dynamic[a$$], {0, 2}, {ContinuousAction -> True, AutoAction -> False}]]}}, AutoDelete -> False, GridBoxItemSize -> {"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, ColumnAlignments -> {Right, Left}], "ManipulateLabel", StripOnInput -> False], Alignment -> {Automatic, Inherited}, StripOnInput -> False], Background -> None, StripOnInput -> False]}, {ItemBox[ TagBox[StyleBox[PaneBox[DynamicBox[ToBoxes[Refresh[\!$$\* TagBox[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"Sin", "[", RowBox[{"x", " ", RowBox[{"(", RowBox[{"1", "+", RowBox[{"a", " ", "x"}]}], ")"}]}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", "6"}], "}"}]}], "]"}], Identity, Editable->True, Selectable->True]$$, TrackedSymbols -> Full], StandardForm], SynchronousUpdating -> Automatic], ImageMargins -> 10], Deployed -> False, ScriptLevel -> 0, GraphicsBoxOptions -> {PreserveImageOptions -> True}, Graphics3DBoxOptions -> {PreserveImageOptions -> True}, StripOnInput -> False], Identity, Selectable -> False, Editable -> False], Alignment -> {Left, Center}, Background -> GrayLevel[1], Frame -> 1, FrameStyle -> GrayLevel[0, 0.2], ItemSize -> Automatic, StripOnInput -> False]}}, AutoDelete -> False, GridBoxItemSize -> {"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, ColumnAlignments -> Left, GridFrame -> False, GridFrameMargins -> 1, RowSpacings -> 2, RowAlignments -> Top], If[CurrentValue["SelectionOver"], ManipulateDumpReadControllerState[(ManipulateDumpupdateOneVar[\ #1, CurrentValue["PreviousFormatTime"], CurrentValue[ "CurrentFormatTime"]] &) /@ {ManipulateDumpcontrollerLink[ a$$, "X1", If["DefaultAbsolute", True, "JB1"], False, {0, 2},
`