Hot answers tagged

6

I'm not sure about all the arguments, but maybe this will get you started: Clear[MultiSlider]; MultiSlider[Dynamic[xs_], {st_, end_}] := LocatorPane[Dynamic[xs], Graphics[{LightGray, Thickness[0.015], Line[{{st, 0}, {end, 0}}]}], {{st, 0}, {end, 0}}] Manipulate[ x, {{x, Table[{2 i, 0}, {i, 5}]}, 0, 12, MultiSlider[##] &}] You can constrain ...


6

You can use the SaveDefinitions option of DynamicModule for this: DynamicModule[{}, Dynamic@a[[2]], SaveDefinitions -> True]


4

Responding to the OP's comment, here is a way to monitor subkernel progress. (* Clear variables *) ToExpression["x" <> ToString[#], StandardForm, Clear] & /@ ParallelEvaluate[$KernelID, Kernels[]]; (* Monitor *) With[{varnames = "x" <> ToString[#] & /@ ParallelEvaluate[$KernelID, Kernels[]]}, With[{vars = ToExpression@varnames}, ...


4

This should do what you are asking about, ParallelEvaluate[x = 0; {$KernelID, With[{x = x}, Dynamic[x]]}] (*{{1,0},{2,0},{3,0},{4,0}}*) But it negates the point of having Dynamic since it won't update. Need to see the full code to see how you want to use it in the end.


3

Just returning to this question now and after reading your addendum I don't think you have adequately set up your test. For example here we see that when the kernel stops the value of a is not preserved and you get error boxes appearing: If you want a to be Global then try this: Dynamic@If[ListQ[a] &&Length[a]>1&& TrueQ[a[[1]] > 0], ...


3

Use the second argument to Dynamic. Example: DynamicModule[{NumSelec = {}}, Column[{ CheckboxBar[ Dynamic[NumSelec, (If[Length[#] > 2, NumSelec = #[[-2 ;;]], NumSelec = #]) &], {1, 2, 3, 4}], Dynamic[NumSelec] }] ]


3

To start your notebook with Dynamic Updating Enabled not being checked add this code to your notebook: Dynamic[, Initialization :> FrontEndExecute[FrontEndToken["ToggleDynamicUpdating"]]] To return the dynamic updating back, you should use ToggleDynamicUpdating again, as you correctly mentioned in the comments: ...


3

This is more or less directly cribbed from the help: Manipulate[Graphics[{color, Polygon[CirclePoints[sides]]}], {{sides, 3,"Number of Sides"}, 3, 17, 1}, {color, Green}]


3

I believe this is the natural and idiomatic way to do it: Manipulate[Graphics[{colour, Polygon[CirclePoints[sides]]}], {sides, 3, 17, 1}, {{colour, Orange}, {Green -> "Green", Orange -> "Orange"}} ]


3

TabView is for viewing. You can associate color changes with the second argument of TabView but it will be easier to just use what is designed for that, like SetterBar. Moreover, the less inside Dynamic the better so instead of creating whole Graphics you can just tell the FrontEnd to take care of that colour and Polygon. DynamicModule[{p = 3, colour = ...


2

Something like this? DynamicModule[ {point1 = {4, 4}, point2 = {4.5, 4.5}, point3 = {5, 5}, point4 = {6, 6}, point5 = {6.5, 6.5}}, dataset = {point1, point2, point3, point4, point5}; p1 = LocatorPane[ Dynamic[dataset], Dynamic[ListPlot[dataset, PlotRange -> {{0, 10}, {0, 10}}]]]]; GraphicsRow[ {p1, Dynamic[ ...


2

Here is one quick way of implementing this behaviour: Module[{i = 0, nb = EvaluationNotebook[]}, CellPrint@Cell[BoxData[ ToBoxes@Panel[Style["Hello World ....", "Button", GrayLevel[0.5], FontColor -> GrayLevel[0.5]], Alignment -> {Center, Center}, Appearance -> {"Default" -> ...


1

Here's a way using a function to rewrite the dynamic value when length of 2 is exceeded. Manipulate[ NumSelec = limit[NumSelec, 2], {NumSelec, {1, 2, 3, 4}, ControlType -> CheckboxBar}, Initialization :> ( limit[x_, num_] := If[ListQ[x], If[Length[x] > num, x[[-num ;;]], x], x]) ]


1

This is one way using DynamicModule DynamicModule[{NumSelec1 = {}, NumSelec2 = {}, NumSelec3 = {}, false}, Column[{ Dynamic@ Row[{CheckboxBar[Dynamic[NumSelec1], {1}, Enabled -> (NumSelec1 =!= {} || false)], CheckboxBar[Dynamic[NumSelec2], {2}, Enabled -> (NumSelec2 =!= {} || false)], ...


1

Changing initial conditions can be accomplished in the same way that parameters are changed. For instance, replace Yb[0] == 0.1 by Yb[0] == Yb0, add the corresponding control, {{Yb0, 0.1}, 0, 1, Appearance -> "Labeled"}, and include Yb0 in the list of TrackedSymbols.


1

Algohi's post answers the above question while adhering to the OP's code very closely. I suggest abandoning such adherence for two reasons. Simpler code. Better localization of variables. Here is what I get by taking Algohi's work as a basis, but simplifying it without worrying about maintaining the structure of the OP's code: DynamicModule[{locators, ...


1

So far and with help of Kuba's links I got the following solution: DynamicModule[{yyyy = 2015, mm = 6, dd = 20, cancel = False}, DialogInput[Grid[{ {"Year:", InputField[Dynamic[yyyy], Number]}, {"Month:", InputField[Dynamic[mm], Number]}, {"Day:", InputField[Dynamic[dd], Number]}, {CancelButton[DialogReturn[cancel = True]], ...



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