Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I followed the instructions given below to play with RunScheduledTask within DynamicModule.

ScheduledTask with scoped variables. Working with timed evaluation

Everything works great until it comes to the Inset, which does not update with the local variable. Any hints are welcome.

 RemoveScheduledTask[ScheduledTasks[]];
 d=DynamicModule[{x=0,y=0},
 {
    Dynamic[x,TrackedSymbols:>{x}],
    Framed@Graphics[{
        Dynamic[Point[{2+#,2+#}]&@x,TrackedSymbols:>{x}],
        Dynamic[
            Inset[
            Framed@Graphics[
                Point[{#+3,#+3}]&@x,
                PlotRange->{{1,5},{0,8}}
            ]
        ], 
        TrackedSymbols->{x}
        ]
    },
        PlotRange->{{0,6},{-1,9}}
    ]
 },
 Initialization:>(RunScheduledTask[x++,{.5,3}];)
 ]

Follow up:

rasher is correct, wrap the inset point in Dynamic works. Thx so much!

 RemoveScheduledTask[ScheduledTasks[]];
   d=DynamicModule[{x=0,y=0},
   {
   Dynamic[x,TrackedSymbols:>{x}],
   Framed@Graphics[{
    Dynamic[Point[{2+#,2+#}]&@x,TrackedSymbols:>{x}],

     Inset[
        Framed@Graphics[

        Dynamic[Point[{#+3,#+3}]&@x,TrackedSymbols:>{x}],
            PlotRange->{{1,5},{0,8}}
        ]
    ]
},
    PlotRange->{{0,6},{-1,9}}
]
},
 Initialization:>(RunScheduledTask[x++,{.5,3}];)
]
share|improve this question

closed as off-topic by Kuba, Jens, bobthechemist, m_goldberg, Yves Klett Nov 17 at 7:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Kuba, Jens, m_goldberg, Yves Klett
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Wrap the inset point in Dynamic –  rasher Mar 3 at 7:41
    
Tried that, no good. –  Benson Mar 3 at 8:16
    
Works for me (assuming result desired are the two points "following" each other). Could you perhaps update post with example? –  rasher Mar 3 at 8:24