(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 12.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 26816, 679] NotebookOptionsPosition[ 24256, 614] NotebookOutlinePosition[ 24635, 630] CellTagsIndexPosition[ 24592, 627] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Basic Examples", "Subsection", CellID->285421464], Cell[TextData[{ "The following ", Cell[BoxData[ FormBox["DynamicModule", TraditionalForm]]], " shows a pink box during the initialization because the inner dynamic \ causes an error message:" }], "Text", CellChangeTimes->{{3.7616421904466853`*^9, 3.7616422499779916`*^9}}, CellID->221583938], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"DynamicModule", "[", RowBox[{ RowBox[{"{", "x", "}"}], ",", "\[IndentingNewLine]", RowBox[{"Dynamic", "[", RowBox[{"First", "[", "x", "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"SynchronousInitialization", "\[Rule]", "False"}], ",", "\[IndentingNewLine]", RowBox[{"Initialization", "\[RuleDelayed]", RowBox[{"(", "\[IndentingNewLine]", RowBox[{ RowBox[{"x", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "3", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", "1"}], "]"}]}], "\[IndentingNewLine]", ")"}]}]}], "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{{3.761642094280177*^9, 3.7616421312922316`*^9}, 3.7616421854408197`*^9, {3.76164390313655*^9, 3.76164391933349*^9}}, CellLabel->"In[54]:=", CellID->402229549], Cell[BoxData[ DynamicModuleBox[{$CellContext`x$$ = {1}}, DynamicBox[ToBoxes[ First[$CellContext`x$$], StandardForm], ImageSizeCache->{8., {0., 9.}}], DynamicModuleValues:>{}, Initialization:>($CellContext`x$$ = {}; Pause[3]; AppendTo[$CellContext`x$$, 1]), SynchronousInitialization->False]], "Output", CellChangeTimes->{3.7616422509723406`*^9, 3.76164392570083*^9}, CellLabel->"Out[54]=", CellID->208899978] }, Open ]], Cell[TextData[{ Cell[BoxData[ FormBox["AsynchronousDynamicModule", TraditionalForm]]], " automatically fixes this problem:" }], "Text", CellChangeTimes->{{3.761642276330385*^9, 3.7616423010018997`*^9}}, CellID->356937009], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ InterpretationBox[ TagBox[ StyleBox[ StyleBox[ FrameBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->Rational[10, 13] Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ StyleBox["\<\"AsynchronousDynamicModule\"\>", "ResourceFunctionLabel"], ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited]} }]], "ResourceFunctionFrame"], FrameBoxOptions->{Background->GrayLevel[0.5, 0.15], BaseStyle->{ "StandardForm", LineSpacing -> {0, 0}, LineBreakWithin -> False}, FrameMargins->{{3, 3}, {0, 0}}, FrameStyle->Directive[ GrayLevel[0.5, 0.35], AbsoluteThickness[0.5]], RoundingRadius->4}, GridBoxOptions->{FrameStyle->GrayLevel[1, 0], GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Automatic}}}, GridBoxFrame->{"Columns" -> {{True}}, "Rows" -> {{True}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0.25}}, "Rows" -> {-0.1, {}, 0}}}], {"FunctionResourceBox", RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784], "\"AsynchronousDynamicModule\""}], ResourceFunction["AsynchronousDynamicModule"], BoxID -> "AsynchronousDynamicModule", Selectable->False], "@", RowBox[{"DynamicModule", "[", RowBox[{ RowBox[{"{", "x", "}"}], ",", "\[IndentingNewLine]", RowBox[{"Dynamic", "[", RowBox[{"First", "[", "x", "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"SynchronousInitialization", "\[Rule]", "False"}], ",", "\[IndentingNewLine]", RowBox[{"Initialization", "\[RuleDelayed]", RowBox[{"(", "\[IndentingNewLine]", RowBox[{ RowBox[{"x", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "3", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", "1"}], "]"}]}], "\[IndentingNewLine]", ")"}]}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.761642013665197*^9, 3.7616420528530736`*^9}, { 3.761642111785324*^9, 3.761642134234969*^9}, 3.761642261867424*^9, { 3.7616424256496944`*^9, 3.7616424287061567`*^9}, {3.761643905992282*^9, 3.761643923288577*^9}}, CellLabel->"In[55]:=", CellID->7099978], Cell[BoxData[ DynamicModuleBox[{$CellContext`x$$ = {1}, $CellContext`initQ$$ = True}, DynamicBox[ToBoxes[ If[ Not[ TrueQ[$CellContext`initQ$$]], ProgressIndicator[Appearance -> "Necklace"], Dynamic[ First[$CellContext`x$$]]], StandardForm], ImageSizeCache->{8., {0., 9.}}, TrackedSymbols:>{$CellContext`initQ$$}], DynamicModuleValues:>{}, Initialization:>($CellContext`initQ$$ = False; ($CellContext`x$$ = {}; Pause[3]; AppendTo[$CellContext`x$$, 1]); $CellContext`initQ$$ = True), SynchronousInitialization->False]], "Output", CellChangeTimes->{{3.761642057864745*^9, 3.7616420628439035`*^9}, { 3.761642113082342*^9, 3.761642134782033*^9}, 3.761642302175415*^9, 3.7616424357488785`*^9, 3.7616439302965417`*^9}, CellLabel->"Out[55]=", CellID->485966614] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Scope", "Subsection", CellID->267254639], Cell[TextData[{ "The ", Cell[BoxData[ FormBox["Print", TraditionalForm]]], " statement will not evaluate before the initialization finishes. All \ evaluation of the ", Cell[BoxData[ FormBox["DynamicModule", TraditionalForm]]], " is prevented before the initialization has finished:" }], "Text", CellChangeTimes->{{3.7616423647542086`*^9, 3.761642372833849*^9}, { 3.7616424509144325`*^9, 3.7616425321725883`*^9}}, CellID->414824544], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ InterpretationBox[ TagBox[ StyleBox[ StyleBox[ FrameBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->Rational[10, 13] Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ StyleBox["\<\"AsynchronousDynamicModule\"\>", "ResourceFunctionLabel"], ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited]} }]], "ResourceFunctionFrame"], FrameBoxOptions->{Background->GrayLevel[0.5, 0.15], BaseStyle->{ "StandardForm", LineSpacing -> {0, 0}, LineBreakWithin -> False}, FrameMargins->{{3, 3}, {0, 0}}, FrameStyle->Directive[ GrayLevel[0.5, 0.35], AbsoluteThickness[0.5]], RoundingRadius->4}, GridBoxOptions->{FrameStyle->GrayLevel[1, 0], GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Automatic}}}, GridBoxFrame->{"Columns" -> {{True}}, "Rows" -> {{True}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0.25}}, "Rows" -> {-0.1, {}, 0}}}], {"FunctionResourceBox", RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784], "\"AsynchronousDynamicModule\""}], ResourceFunction["AsynchronousDynamicModule"], BoxID -> "AsynchronousDynamicModule", Selectable->False], "@", RowBox[{"DynamicModule", "[", RowBox[{ RowBox[{"{", "x", "}"}], ",", "\[IndentingNewLine]", RowBox[{"Dynamic", "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", "\"\\"", "]"}], ";", "\[IndentingNewLine]", RowBox[{"First", "[", "x", "]"}]}], "\[IndentingNewLine]", "]"}], ",", "\[IndentingNewLine]", RowBox[{"SynchronousInitialization", "\[Rule]", "False"}], ",", "\[IndentingNewLine]", RowBox[{"Initialization", "\[RuleDelayed]", RowBox[{"(", "\[IndentingNewLine]", RowBox[{ RowBox[{"x", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "3", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", "1"}], "]"}]}], "\[IndentingNewLine]", ")"}]}]}], "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.7616423456977415`*^9, 3.7616424045961947`*^9}, { 3.7616439411583476`*^9, 3.7616439464391212`*^9}}, CellLabel->"In[56]:=", CellID->118924454], Cell[BoxData[ DynamicModuleBox[{$CellContext`x$$ = {1}, $CellContext`initQ$$ = True}, DynamicBox[ToBoxes[ If[ Not[ TrueQ[$CellContext`initQ$$]], ProgressIndicator[Appearance -> "Necklace"], Dynamic[Print["Hi!"]; First[$CellContext`x$$]]], StandardForm], ImageSizeCache->{8., {0., 9.}}, TrackedSymbols:>{$CellContext`initQ$$}], DynamicModuleValues:>{}, Initialization:>($CellContext`initQ$$ = False; ($CellContext`x$$ = {}; Pause[3]; AppendTo[$CellContext`x$$, 1]); $CellContext`initQ$$ = True), SynchronousInitialization->False]], "Output", CellChangeTimes->{{3.761642357641426*^9, 3.7616423867486086`*^9}, 3.7616424418472075`*^9, 3.761642479481435*^9, 3.761642534269971*^9, 3.7616439486928387`*^9}, CellLabel->"Out[56]=", CellID->112099878] }, Open ]], Cell["\<\ Any placeholder can be used to show progress of the initialization:\ \>", "Text", CellChangeTimes->{{3.7616423647542086`*^9, 3.761642372833849*^9}, { 3.7616424509144325`*^9, 3.7616425321725883`*^9}, {3.7616428372745504`*^9, 3.7616428546975145`*^9}, {3.762015520634033*^9, 3.7620155215111213`*^9}}, CellID->25253551], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ InterpretationBox[ TagBox[ StyleBox[ StyleBox[ FrameBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->Rational[10, 13] Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ StyleBox["\<\"AsynchronousDynamicModule\"\>", "ResourceFunctionLabel"], ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited]} }]], "ResourceFunctionFrame"], FrameBoxOptions->{Background->GrayLevel[0.5, 0.15], BaseStyle->{ "StandardForm", LineSpacing -> {0, 0}, LineBreakWithin -> False}, FrameMargins->{{3, 3}, {0, 0}}, FrameStyle->Directive[ GrayLevel[0.5, 0.35], AbsoluteThickness[0.5]], RoundingRadius->4}, GridBoxOptions->{FrameStyle->GrayLevel[1, 0], GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Automatic}}}, GridBoxFrame->{"Columns" -> {{True}}, "Rows" -> {{True}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0.25}}, "Rows" -> {-0.1, {}, 0}}}], {"FunctionResourceBox", RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784], "\"AsynchronousDynamicModule\""}], ResourceFunction["AsynchronousDynamicModule"], BoxID -> "AsynchronousDynamicModule", Selectable->False], "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"DynamicModule", "[", RowBox[{ RowBox[{"{", "x", "}"}], ",", "\[IndentingNewLine]", RowBox[{ "Dynamic", "[", "\[IndentingNewLine]", "x", "\[IndentingNewLine]", "]"}], ",", "\[IndentingNewLine]", RowBox[{"SynchronousInitialization", "\[Rule]", "False"}], ",", "\[IndentingNewLine]", RowBox[{"Initialization", "\[RuleDelayed]", RowBox[{"(", "\[IndentingNewLine]", RowBox[{ RowBox[{"x", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "1", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", "1"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "1", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", "2"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "1", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", "3"}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "1", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", "4"}], "]"}], ";"}], "\[IndentingNewLine]", ")"}]}]}], "\[IndentingNewLine]", "]"}], ",", "\[IndentingNewLine]", RowBox[{"Dynamic", "@", RowBox[{"ProgressIndicator", "[", RowBox[{ RowBox[{"Length", "[", "x", "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "4"}], "}"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{{3.7616423456977415`*^9, 3.7616424045961947`*^9}, { 3.7616425643636293`*^9, 3.7616426458025613`*^9}, {3.7616426760756893`*^9, 3.7616428246648273`*^9}, {3.76164396020791*^9, 3.7616439650846963`*^9}}, CellLabel->"In[57]:=", CellID->935805739], Cell[BoxData[ DynamicModuleBox[{$CellContext`x$$ = {1, 2, 3, 4}, $CellContext`initQ$$ = True}, DynamicBox[ToBoxes[ If[ Not[ TrueQ[$CellContext`initQ$$]], Dynamic[ ProgressIndicator[ Length[$CellContext`x$$], {0, 4}]], Dynamic[$CellContext`x$$]], StandardForm], ImageSizeCache->{87., {3., 9.}}, TrackedSymbols:>{$CellContext`initQ$$}], DynamicModuleValues:>{}, Initialization:>($CellContext`initQ$$ = False; ($CellContext`x$$ = {}; Pause[1]; AppendTo[$CellContext`x$$, 1]; Pause[1]; AppendTo[$CellContext`x$$, 2]; Pause[1]; AppendTo[$CellContext`x$$, 3]; Pause[1]; AppendTo[$CellContext`x$$, 4]; Null); $CellContext`initQ$$ = True), SynchronousInitialization->False]], "Output", CellChangeTimes->{{3.761642721091035*^9, 3.7616428249539766`*^9}, 3.7616428625482984`*^9, 3.7616437070562925`*^9, 3.7616439669706993`*^9}, CellLabel->"Out[57]=", CellID->159383153] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Applications", "Subsection", CellID->20767984], Cell[TextData[{ "You can specify a dynamically updated variable that returns the content to \ its initialization state. This update action can then be re-used in the \ content of the ", Cell[BoxData[ FormBox["DynamicModule", TraditionalForm]]], ":" }], "Text", CellChangeTimes->{{3.7616423647542086`*^9, 3.761642372833849*^9}, { 3.7616424509144325`*^9, 3.7616425321725883`*^9}, {3.7616428372745504`*^9, 3.7616428546975145`*^9}, {3.761643055395462*^9, 3.7616431113552723`*^9}, { 3.7616434242310247`*^9, 3.7616434504988327`*^9}, 3.762015640249994*^9, { 3.7620157291288805`*^9, 3.7620157885308204`*^9}, {3.762015850476014*^9, 3.7620158874677134`*^9}}, CellID->393324238], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ InterpretationBox[ TagBox[ StyleBox[ StyleBox[ FrameBox[GridBox[{ { StyleBox[ StyleBox[ AdjustmentBox["\<\"[\[FilledSmallSquare]]\"\>", BoxBaselineShift->-0.25, BoxMargins->{{0, 0}, {-1, -1}}], "ResourceFunctionIcon", FontColor->RGBColor[ 0.8745098039215686, 0.2784313725490196, 0.03137254901960784]], ShowStringCharacters->False, FontFamily->"Source Sans Pro Black", FontSize->Rational[10, 13] Inherited, FontWeight->"Heavy", PrivateFontOptions->{"OperatorSubstitution"->False}], StyleBox[ StyleBox["\<\"AsynchronousDynamicModule\"\>", "ResourceFunctionLabel"], ShowStringCharacters->False, FontSize->Rational[12, 13] Inherited]} }]], "ResourceFunctionFrame"], FrameBoxOptions->{Background->GrayLevel[0.5, 0.15], BaseStyle->{ "StandardForm", LineSpacing -> {0, 0}, LineBreakWithin -> False}, FrameMargins->{{3, 3}, {0, 0}}, FrameStyle->Directive[ GrayLevel[0.5, 0.35], AbsoluteThickness[0.5]], RoundingRadius->4}, GridBoxOptions->{FrameStyle->GrayLevel[1, 0], GridBoxAlignment->{"Columns" -> {{Left}}, "Rows" -> {{Automatic}}}, GridBoxFrame->{"Columns" -> {{True}}, "Rows" -> {{True}}}, GridBoxItemSize->{"Columns" -> {{Automatic}}, "Rows" -> {{Automatic}}}, GridBoxSpacings->{"Columns" -> {{0.25}}, "Rows" -> {-0.1, {}, 0}}}], {"FunctionResourceBox", RGBColor[0.8745098039215686, 0.2784313725490196, 0.03137254901960784], "\"AsynchronousDynamicModule\""}], ResourceFunction["AsynchronousDynamicModule"], BoxID -> "AsynchronousDynamicModule", Selectable->False], "[", "\[IndentingNewLine]", RowBox[{ RowBox[{"DynamicModule", "[", RowBox[{ RowBox[{"{", "\[IndentingNewLine]", RowBox[{ "x", ",", "\[IndentingNewLine]", "start", ",", "\[IndentingNewLine]", "updateAction"}], "\[IndentingNewLine]", "}"}], ",", "\[IndentingNewLine]", RowBox[{"Dynamic", "[", "\[IndentingNewLine]", RowBox[{"Column", "[", RowBox[{"{", "\[IndentingNewLine]", RowBox[{"x", ",", "\[IndentingNewLine]", RowBox[{"Slider", "[", RowBox[{ RowBox[{"Dynamic", "[", "start", "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "10", ",", "1"}], "}"}]}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Button", "[", RowBox[{"\"\\"", ",", "\[IndentingNewLine]", RowBox[{"updateAction", "[", "start", "]"}], ",", "\[IndentingNewLine]", RowBox[{"Method", "\[Rule]", "\"\\""}], ",", "\[IndentingNewLine]", RowBox[{"ImageSize", "\[Rule]", "All"}]}], "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "}"}], "]"}], "\[IndentingNewLine]", "]"}], ",", "\[IndentingNewLine]", RowBox[{"SynchronousInitialization", "\[Rule]", "False"}], ",", "\[IndentingNewLine]", RowBox[{"Initialization", "\[RuleDelayed]", RowBox[{"(", "\[IndentingNewLine]", RowBox[{ RowBox[{"start", "=", "0"}], ";", "\[IndentingNewLine]", RowBox[{ RowBox[{"updateAction", "[", "startVal_", "]"}], ":=", RowBox[{"(", "\[IndentingNewLine]", RowBox[{ RowBox[{"initQ", "=", "False"}], ";", "\[IndentingNewLine]", RowBox[{"x", "=", RowBox[{"{", "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "1", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", RowBox[{"startVal", "+", "1"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "1", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", RowBox[{"startVal", "+", "2"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "1", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", RowBox[{"startVal", "+", "3"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Pause", "[", "1", "]"}], ";", "\[IndentingNewLine]", RowBox[{"AppendTo", "[", RowBox[{"x", ",", RowBox[{"startVal", "+", "4"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"initQ", "=", "True"}]}], "\[IndentingNewLine]", ")"}]}], ";", "\[IndentingNewLine]", RowBox[{"updateAction", "[", "start", "]"}]}], "\[IndentingNewLine]", ")"}]}]}], "\[IndentingNewLine]", "]"}], ",", "\[IndentingNewLine]", RowBox[{"Dynamic", "@", RowBox[{"ProgressIndicator", "[", RowBox[{ RowBox[{"Length", "[", "x", "]"}], ",", RowBox[{"{", RowBox[{"0", ",", "4"}], "}"}]}], "]"}]}], ",", "\[IndentingNewLine]", "initQ"}], "\[IndentingNewLine]", "]"}]], "Input", CellChangeTimes->{{3.7616423456977415`*^9, 3.7616424045961947`*^9}, { 3.7616425643636293`*^9, 3.7616426458025613`*^9}, {3.7616426760756893`*^9, 3.7616428246648273`*^9}, {3.761642901414431*^9, 3.761643033148739*^9}, { 3.7616434926527233`*^9, 3.761643592347995*^9}, {3.761643995454037*^9, 3.7616440120221105`*^9}, {3.762015564964466*^9, 3.762015577922762*^9}}, CellLabel->"In[59]:=", CellID->164751616], Cell[BoxData[ DynamicModuleBox[{$CellContext`x$$ = {1, 2, 3, 4}, $CellContext`start$$ = 0, $CellContext`updateAction$$, $CellContext`initQ$$ = True}, DynamicBox[ToBoxes[ If[ Not[ TrueQ[$CellContext`initQ$$]], Dynamic[ ProgressIndicator[ Length[$CellContext`x$$], {0, 4}]], Dynamic[ Column[{$CellContext`x$$, Slider[ Dynamic[$CellContext`start$$], {0, 10, 1}], Button["Update", $CellContext`updateAction$$[$CellContext`start$$], Method -> "Queued", ImageSize -> All]}]]], StandardForm], ImageSizeCache->{200., {33.634033203125, 39.365966796875}}, TrackedSymbols:>{$CellContext`initQ$$}], DynamicModuleValues:>{{ DownValues[$CellContext`updateAction$$] = {HoldPattern[ $CellContext`updateAction$$[ Pattern[$CellContext`startVal$, Blank[]]]] :> ($CellContext`initQ$$ = False; $CellContext`x$$ = {}; Pause[1]; AppendTo[$CellContext`x$$, $CellContext`startVal$ + 1]; Pause[1]; AppendTo[$CellContext`x$$, $CellContext`startVal$ + 2]; Pause[1]; AppendTo[$CellContext`x$$, $CellContext`startVal$ + 3]; Pause[1]; AppendTo[$CellContext`x$$, $CellContext`startVal$ + 4]; $CellContext`initQ$$ = True)}}}, Initialization:>($CellContext`initQ$$ = False; ($CellContext`start$$ = 0; $CellContext`updateAction$$[ Pattern[$CellContext`startVal$, Blank[]]] := ($CellContext`initQ$$ = False; $CellContext`x$$ = {}; Pause[1]; AppendTo[$CellContext`x$$, $CellContext`startVal$ + 1]; Pause[1]; AppendTo[$CellContext`x$$, $CellContext`startVal$ + 2]; Pause[1]; AppendTo[$CellContext`x$$, $CellContext`startVal$ + 3]; Pause[1]; AppendTo[$CellContext`x$$, $CellContext`startVal$ + 4]; $CellContext`initQ$$ = True); $CellContext`updateAction$$[$CellContext`start$$]); \ $CellContext`initQ$$ = True), SynchronousInitialization->False]], "Output", CellChangeTimes->{{3.7616429780345545`*^9, 3.761642983149806*^9}, { 3.7616430192321353`*^9, 3.7616430336395206`*^9}, 3.7616431145269427`*^9, { 3.7616435678529377`*^9, 3.7616436231859617`*^9}, {3.7616437129130297`*^9, 3.76164373867708*^9}, {3.761644014079875*^9, 3.761644027594265*^9}}, CellLabel->"Out[59]=", CellID->633455729] }, Open ]] }, Open ]] }, WindowSize->{808, 855}, WindowMargins->{{436, Automatic}, {Automatic, 50}}, FrontEndVersion->"12.0 for Mac OS X x86 (64-bit) (April 8, 2019)", StyleDefinitions->"Default.nb", $CellContext`ClosingSaveDialog -> False ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[580, 22, 56, 1, 70, "Subsection",ExpressionUUID->"a6f517e2-2793-408e-a062-b69d3571bbad", CellID->285421464], Cell[639, 25, 298, 8, 70, "Text",ExpressionUUID->"62bcc08b-af99-4948-95fd-e7b8ba9c7b1c", CellID->221583938], Cell[CellGroupData[{ Cell[962, 37, 899, 20, 70, "Input",ExpressionUUID->"b821233b-2e56-4c21-b303-204db2e1f1d4", CellID->402229549], Cell[1864, 59, 432, 11, 70, "Output",ExpressionUUID->"c9eb1287-6e54-4633-9fa5-d6d1eceadd9d", CellID->208899978] }, Open ]], Cell[2311, 73, 227, 6, 70, "Text",ExpressionUUID->"d4033b0b-425e-42fe-bc50-c6a91ae6217f", CellID->356937009], Cell[CellGroupData[{ Cell[2563, 83, 2853, 68, 70, "Input",ExpressionUUID->"69342bd2-a340-4ae3-ac36-b7afa987e22b", CellID->7099978], Cell[5419, 153, 817, 19, 70, "Output",ExpressionUUID->"63b9d519-5e74-4091-aba9-176ac4a6c84d", CellID->485966614] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[6285, 178, 47, 1, 70, "Subsection",ExpressionUUID->"ac3e0f29-cad4-4634-ad2b-6ef3dced765b", CellID->267254639], Cell[6335, 181, 444, 12, 70, "Text",ExpressionUUID->"629f458f-a47b-4ea3-853c-786aae5bc134", CellID->414824544], Cell[CellGroupData[{ Cell[6804, 197, 2888, 70, 70, "Input",ExpressionUUID->"814cb7b0-8c60-41d4-a34b-e7e91158cb8e", CellID->118924454], Cell[9695, 269, 800, 18, 70, "Output",ExpressionUUID->"2aa6e519-d29e-4f25-ba51-1cfd32ee92cf", CellID->112099878] }, Open ]], Cell[10510, 290, 332, 6, 70, "Text",ExpressionUUID->"a10884eb-567a-42db-bb00-da5bbd25979d", CellID->25253551], Cell[CellGroupData[{ Cell[10867, 300, 3699, 85, 70, "Input",ExpressionUUID->"4d3f5bf3-3e39-4545-818c-2a6b9d6ffdf6", CellID->935805739], Cell[14569, 387, 944, 23, 70, "Output",ExpressionUUID->"061582ab-a077-43a9-a4f8-137137506aa1", CellID->159383153] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[15562, 416, 53, 1, 70, "Subsection",ExpressionUUID->"7a9d1800-b60d-47e1-b663-bae09b1ecd9a", CellID->20767984], Cell[15618, 419, 691, 14, 70, "Text",ExpressionUUID->"b01c4c6c-5959-4493-99c9-dd52d08e22c0", CellID->393324238], Cell[CellGroupData[{ Cell[16334, 437, 5563, 124, 70, "Input",ExpressionUUID->"b48b24db-9af2-4d8e-9c57-cdc4857c0d37", CellID->164751616], Cell[21900, 563, 2328, 47, 70, "Output",ExpressionUUID->"988a75d2-ca86-440e-b4f9-0956a20a2504", CellID->633455729] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)