Tag Info

Hot answers tagged

11

CurrentValue["ControlsFontFamily"] (* "Segoe UI" on Version 9 / Windows 8 *) (* "Lucida Grande" on OS X 10.6.8 -- thanks: m_goldberg *) (* "Bitstream Vera Sans" on Fedora 20 -- thanks Oska *) CurrentValue["ControlsFontSize"] (* 12 on Version 9 / Windows 8 *) Style[StringJoin[CharacterRange["a", "z"]], FontFamily :> CurrentValue["ControlsFontFamily"], ...


7

There are a lot of different ways to do this. My current favorite is Manipulate[{a, b}, {a, 1, 10}, {b, 1, 10, TrackingFunction -> (b = #; a = 10; &)}]


6

I do nor know how to implement what you want to do in a Manipulate expression using locators, because I don't know how to handle mouse events in a Manipulate expression. However, if you are willing to accept an answer using EventHandler, the behavior you ask for isn't very difficult to implement. With[{δ = .2}, DynamicModule[{p1 = {0, 0}, p2 = {2, 2}, ...


6

This is what I find more intuitive: circle[] := DynamicModule[{a = {0, 0}, b = {1, 0}, r = 1, w}, { Dynamic@Circle[a, r], Locator[Dynamic[a, {(w = b - a) &, (a = #; b = a + w) &, None}]], Locator[Dynamic[b, (b = #; r = Norm[b - a]) &]] }] Graphics[circle[], Frame -> True, PlotRange -> 2] And this is what fits well ...


6

Less ambitious: addbutton[manipulate_] := With[{box = ToBoxes@manipulate}, With[{proc = Cases[box, HoldPattern["Variables" :> _], ∞]}, With[{button = Button["Reset", CompoundExpression["Variables"] /. proc]}, Composition[ToExpression, BoxData][ box /. {("Body" :> x_) :> "Body" :> Column[{button, x}]}]]]] ...


6

One difficulty in using Manipulate is that it rewrites your code for you in ways that are not clearly explained in the documentation. The thinking is that this rewriting achieves the dynamic interactions described in the documentation without burdening the programmer with some of the tedious details involved. For instance, expressions that contain ...


6

There's no way to do this that conforms fully to UI guidelines (at least not for OS X). For example, your "disabled" items will still highlight as you hover over them and will still react to selection (thought they will do nothing). This is as close as you can get: Manipulate[ {filter, list} , {{filter, 1, "Filter:"}, {1, 2, 3, 4, 5, 6}, ControlType ...


5

I do this all the time, but use small buttons next to the slider. This is handy when one wants to jump to specific value, and sometimes it is hard to get the slider to go there exactly without few hits and misses and one ends up opening the slider using "+" and typing in the value in the small window which is not very efficient sometimes. Here is an example ...


4

This is a bug in the Mathematica FrontEnd that appears on systems running Mac OS X 10.10. The cause is a change, beginning with Yosemite, in the behavior of the API used to draw the popup arrow. The FrontEnd bug will be fixed in an upcoming release.


4

Not completely tested, based on undocumented structure of the DynamicModule constructed by Manipulate -- but it works for now: Manipulate[a + b + c, {{a, 1}, 0, 5}, {{b, 2}, 0, 5}, {c, 0, 5}, Button["Reset", Replace[ Typeset`specs, {{{Hold[var_Symbol], val_}, ___} :> (var = val), {Hold[var_Symbol], val_, ___} :> (var = val)}, 1]] ] ...


4

You can try something like: RemoveScheduledTask @ ScheduledTasks[]; RunScheduledTask[c = Round[ControllerState["Y Axis"], .1], .1] Dynamic[{RandomReal[], c}] (*RandomReal tells us when c triggers updating*) Plot[{Sin[x]}, {x, 0, 2}, GridLines -> Dynamic[{{1}, {c}}]] So the Dynamic is not triggered by controller itself but by the value of it. It will ...


4

With small modifications of the code provided by m_goldberg you can get the Button and the ProgressIndicator in the same Row. However, it is always there now and will not appear and disappear. DynamicModule[{n = 1}, Row[{Button["Start", n = 1; Do[Pause[0.1]; ++n, {i, 1, 100}], Method -> "Queued"], Spacer[23], Dynamic[ProgressIndicator[n, {1, ...


4

You need to do some initialization. Manipulate often behaves strangely when its controls are not initialized properly. f[u_] := If[u <= 1, 5, 0]; Manipulate[ Column[{ Row[{"x: ", x, " f[x]: ", f[x]}], Row[{"ang: ", ang, " f[ang]: ", f[ang]}]}], {x, 0, 2}, {{ang, x}, x, 2}] (* initialization added to control *)


4

Edit In my opinion, what is asked for is more easily done when the button graphics and the model graphics are kept in separate lists. Manipulate[ Column[{ Graphics3D[ MapIndexed[ If[FreeQ[u, models[[#2[[1]]]]], Button[#[[1]], AppendTo[u, models[[#2[[1]]]]]], Button[#[[1]], u = DeleteCases[u, models[[#2[[1]]]]]]] ...


4

Ok, I read it again and again and I think I know what you are after. Here's quick fix/adjustment to make this thing a valid controller: SetAttributes[customColorSetter, HoldFirst] customColorSetter[var_] := ( If[! MatchQ[var, _RGBColor], var = Black]; Delete[ FrontEndResource["RGBColorValueSelector"][[1, 1]], {{1, 1}} ] /. ...


3

I reported the issue discussed in this question to Wolfram technical support. I have received the following reply: It does appear that Animator is not behaving properly in this case and I have forwarded an incident report to our developers with the information you provided. On the basis of this reply, I have tagged this question with bugs.


3

n = 3; Manipulate[Graphics[{Circle[{0, 0}],Line[{{0, 0}, a[[#]]} & /@Range[Length@a]]}], {{a, RandomReal[{0, 1}, {n, 2}]}, Locator, LocatorAutoCreate -> True}] Alternatively, Manipulate[Graphics[{Circle[{0, 0}], Line[Tuples[{{{0, 0}}, a}]]}], {{a, RandomReal[{0, 1}, {n, 2}]}, Locator, LocatorAutoCreate -> True}]


3

Download code You can download a notebook with all the code in it by running the following code: Import["http://goo.gl/NaH6rM"]["http://i.stack.imgur.com/sMWJ2.png"] Code with comments The first thing to do is to separate your headings from your data: rawdata = {{"n", "t(n)", "t(n)/t(n-1)", "Ø(t(n)/t(n-1))"}, {20., 1.15, "", 1.30081}, {21., 1.54, ...


3

Dialogs are notebooks with different from regular options settings, so you can export save them as you want: (that is the case with palettes too) Export[ FileNameJoin[{$TemporaryDirectory, "myDialog.nb"}], CreateDialog[ Column[{ InputField[Dynamic[a], Number, FieldHint -> "enter a"], InputField[Dynamic[b], Number, FieldHint ...


3

Is this what you mean? Manipulate[ Grid[{{txt}, {idx}}], Grid[{ {"T", InputField[Dynamic[txt, {txt = #; idx = StringLength[txt]} &], String, ContinuousAction -> True]}, {"index", Manipulator[Dynamic[idx, {idx = #} &], {0, Dynamic@StringLength[txt], 1}], Dynamic[idx]} }], {{txt, ""}, None}, {{idx, 0}, None} ]


3

I do not understand everything the code is suppose to do, but passing the control as a pure function inside a variable declaration might give the desired behavior. The other change is the variable-setting function in the Dynamic for r4 was changed to actually set the value of r4 upon an update. Manipulate[ Row@start, {{r2, "q", "R2"}, {"p", "m", "q", ...


3

The closest I can get to what you ask for is DynamicModule[{n}, Button["Start", n = 0; Monitor[Do[Pause[0.1]; ++n, {i, 1, 100}], Dynamic[ProgressIndicator[n, {1, 100}]]], Method -> "Queued"]] which, after the button is clicked on, produces The progress indicator appears in its own temporary cell, not in a row with the button. ...


3

One can slightly rewrite your code and obtain a nice Manipulate f[x_, a_, μ_, σ_] := a Exp[-(x - μ)^2/(2 σ^2)]/(Sqrt[2 π] σ) n = 3; vars = Through@{a, μ, σ}@# & /@ Range[n]; func = f[x, ##] & @@@ vars; values = {{50, 5, 20}, {50, 50, 40}, {100, 80, 20}}; rangelow = 0.7 values; rangehigh = 1.3 values; With[{func = func}, Manipulate[Plot[func, ...


3

The problem is, that the Head of series is now Dynamic. With a simple Part you get rid of this: ListPlot[series[[1]], PlotLabel -> title] Besides, why not using Manipulate? Your problem seem perfectly suited for this: Manipulate[ forest = Range[30]; energy = Reverse[Range[30]]; Switch[choice , 1, series = forest; title = "Tree Growth" , 2, ...


3

It's a DynamicModule not a Manipulate, but it works (Mma V10.1 on Mac and Windows) DynamicModule[{filter, list = 1}, Column[{ PopupMenu[Dynamic[filter], Range[6]], PopupMenu[Dynamic[list], Table[With[{i = i}, (If[i < filter, list = list, list = i]) -> i], {i, 6}]], {"filter", Dynamic[filter]}, {"list", Dynamic[list]} }]] ...


3

ControlActive doesn't respond to SetterBar, as changing a value using SetterBar doesn't make $ControlActiveSetting being True. Here is one way to make using the SetterBar reset k: Manipulate[ Row[{x, Spacer[10], y, Spacer[10], ControlActive[k = 0, k++], Spacer[10], $ControlActiveSetting}], {x, {5, 6, 7, 8}, ControlType -> SetterBar, ...


3

There are couple of ways to handle your problem. Simple -- give a warning of slider interference: Manipulate[ If[t1 < t2, Plot[t^2, {t, t1, t2}], "Warning: t1 > t2"], {{t1, -1}, -2, 2, 0.1, Appearance -> "Labeled"}, {{t2, 1}, -2, 2, 0.1, Appearance -> "Labeled"}] More elegant user interface, less elegant code -- prevent slider ...


2

Generally, Dynamic is used in two ways: Re-evaluating expressions when they would change, and displaying the result. The syntax is Dynamic[expr]. Dynamic[expr] cannot be used to represent the value of expr in different context and calculate with it. It is only used to display it. Allowing controls to change values of variables. Typical syntax: ...


2

If you are not insisting on calling the Manipulate-menu's bookmark, the following approach might do the job: Manipulate[Column[{Plot[TriangleWave[a x], {x, 0, 1}], Button["Custom Reset", (* first go back within the notebook *) SelectionMove[EvaluationNotebook[], Previous, Cell]; SelectionMove[EvaluationNotebook[], Previous, Cell]; ...


2

Something like this?: data = {1, 1, 2, 2}; DynamicModule[{max = Tr @ data, x}, Manipulate[ Normal @ SparseArray[Thread[x -> 1], max], ## ] & @@ Thread[{x, Internal`PartitionRagged[Range@max, data], ControlType -> TogglerBar}] ]



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