Tag Info

Hot answers tagged

4

This can be done more cleanly by localizing curve to the manipulate, which in turn is done by making curve an invisible control. This also obviates the need for the Initialization option, because controls take optional initializers. Manipulate[ Graphics[{ {Red, PointSize @ .02, Point@pt}, Line @ AppendTo[curve, pt]}, Axes -> True, ...


4

An alternative approach using CurrentValue["MouseOver"]: Button[Panel["Print", FrameMargins -> {{4, 4}, {4, 4}}, Background -> Dynamic@If[CurrentValue["MouseOver"], Green, Red]], Print["Print"], Appearance -> None]


3

Another method which doesn't really use Mouseover but the EventHandler: DynamicModule[{col = Red}, EventHandler[ Button[ Panel["Print", FrameMargins -> {{4, 4}, {4, 4}}, Background -> Dynamic[col]], ...


3

The Plot has to be within Dynamic, as the Plot needs to be updated when z is changed. You can't just update the content of Plot without making a new Plot. {Slider[Dynamic[z], {1, 4, 1}], Dynamic@Plot[Evaluate[Table[Sin[i*t], {i, 1, z}]], {t, 0, 2 Pi}]} The syntax highlighting is due to the Head of your command inside Plot being Dynamic ...


2

Replacing the Set in Initialization by a SetDelayed solved the problem, TrackedSymbols should be set also. Conjecture: It seems Clear before Manipulate produces problems, I can't believe it. It can be used in a separate cell, but not in the same cell. Experiences? Manipulate[ curve = Append[curve, pt]; Graphics[{{Red, PointSize@.02, Point@pt}, ...


2

Pardon me if this is unjustifiably curt but I don't see how this problem is different from many others that result from placing Dynamic too deep within an expression. Move the Dynamic to the outside and the element in question updates just fine: on = True; Row@{Checkbox@Dynamic@on, Spacer@10, ExpressionCell[ Dynamic@RawBoxes@ RowBox@{"Block", ...


2

The last three locals are actually String, i.e. "\"local\"" at the box level. The fourth from the end, however, should be due to lacking of syntax highlight at the FrontEnd. For this problem, I guess you'll have to force the FrontEnd re-render the ExpressionCell after each update of the on. Usually this can be done by changing an option of the cell (like ...


1

There are lots of ways to do what you want. I would not use Module. Here are three, all of which use methods other than Module to localize variables: SeedRandom @ 42; With[{rand = RandomInteger[10, {5, 5, 2}]}, Manipulate[ ListPlot[rand[[i]], PlotRange -> {{-1, 11}, {-1, 11}}], {i, 1, Length[rand], 1, Appearance -> "Labeled"}]] SeedRandom @ ...


1

if you need to keep the definition of l inside manipulate, I think you can try this Manipulate[l = RandomInteger[10, {3, 5, 2}]; ListPlot[l[[i]], PlotRange -> {{-1, 11}, {-1, 11}}], {i, 1, Dynamic@Length@l, 1}] you need to know that for every i, l will be computed again and again. if you want to do 3 plot per each l then you can do it like this ...


1

I found an answer to my own question by reading the answer to Make dynamic controls from existing list. So I guess the answer to my question is to define the functions internally in the dynamic module with the HoldFist attribute. DynamicModule[{controlGenerate, ruleslist = ruleslist, ruleslist2 = ruleslist2, result, controlfromList}, ...



Only top voted, non community-wiki answers of a minimum length are eligible