Hot answers tagged

7

An adaption of this answer for an ActionMenu and to your styling: assnMenuK[slowF_, a_Association, title_: "Choose"] := DynamicModule[{done = False, lastSelection = ""}, Grid[{{ ActionMenu[title, KeyValueMap[#2 :> (lastSelection = #2; done = "working"; slowF[#1]; done = True) &, a], Method -> "Queued"], Dynamic@Style[...


6

It seems that Control is just a wrapper for Manipulate`Control, and that function expects a Symbol as its first argument: Control[]; (*preload*) ClearAttributes[Manipulate`Control, {Protected, ReadProtected}] Block[{$Context = "Manipulate`Dump`"}, Definition[Manipulate`Control] // Print; ] Manipulate`Control[var_, Manipulate`Dump`opts___Rule, ...


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

Manipulate[None, Grid[{ {Dynamic@ListPlot[{a, b, c, d}], Grid[{ {Style["a and b in a column on the right", Orange, Bold]}, {Control[{{a, 1, "a->"}, 0, 5, Appearance -> "Open"}]}, {Control[{{b, 1, "b->"}, 0, 5, Appearance -> "Open"}]} }], Grid[{ {Style["c and d in a column on the more right", Blue, Bold]},...


6

Something like this? Manipulate[ Plot[Sin[x] + a, {x, -3, 3}], OpenerView[{"open to control ", Control[{{a, 1, "a"}, 0, 10, 1}]}] ]


6

Example DynamicModule[ {value = 10}, Panel @ Row @ { Slider[Dynamic @ value, {1, 100, 1}, ImageSize -> Small], InputField[Dynamic @ value, Enabled -> False, ImageSize -> {36, 18}], Button["-", value--], Button["+", value++] } ] Output EDIT In order to restrict Slider to a set of pre-defined values, please see ...


5

Try this Button["Evaluate", Speak["Let me think..."]; Pause[3]; (* Here all the task code *) Speak["I shall learn to make good questions and show my own efforts"]; SystemOpen["http://mathematica.stackexchange.com/help/how-to-ask"] , Method -> "Queued"]


5

Based on the documentation, Slider is the only control object used in your code that supports a list of expression as its settings. Here is a custom alternative. DynamicModule[{list = {0.001, 0.0025, 0.005, 0.006, 0.007, 0.008, 0.009, 0.01}, l}, Row[{ Slider[Dynamic@l, {list}], Spacer[5], InputField[Dynamic[l, If[MemberQ[list, #], l = #] &], ...


4

two things to consider: FileNameSetter is used to generate a button which then subsequently gets pressed to open a window. When a window opens for you to select a file it is best to use the queued evaluation channel rather than preemptive. Try this instead: ActionMenu["select an option", {"choose a file" :> (x=SystemDialogInput["FileOpen"])}, ...


4

The question seems to be expounded somewhat and also answered in a comment by John Fultz: I received an internal bug report indicating that the underlying code was the same as referenced in this question. If so, this is not a bug. The code was something of the form Manipulate[Graphics3D[Cone[], ViewPoint -> RotationMatrix[t, {0, 0, 1}].{1.3, -2.4, 2}],...


4

A simple way is to define your Manipulate variable parameters so that they are recognised as the control type you want. Look in the first part of the Details and Options section of Manipulate documentation. Manipulate[ Plot[Sin[a + b x], {x, 0, 10}], {{a, 0}, {0, 1}}, {b, 1, 5}] You can get fancier by specifying the controls and layout directly. ...


4

I suppose the it is expected and it happens because after prompting a DialogNotebook the evaluation of Module is finished and a Temporary attribute of its variables is kicking in. Why the first example works the second doesn't? I don't know but how a Temporary attribute works is not documented well. One way to make it work is to use kernel blocking ...


4

The problem is with Animator. When it is passed a list, the +/- buttons increment the index of the setting by about 5-10%. It seems to pick a "nice" increment that is 1, 2 or 5 times a power of 10. When the length of the list is less than 10, it does not behave well. It seems that an increment of 0 is what is sometimes calculated. (Personally, I would ...


3

It can also be done this way. I recommend it because it avoids passing any complicated dynamic expression to AngularGauge. Dynamic[ AngularGauge[ Quantity[DateDifference[Now, Tomorrow, "Minute"]], {Quantity[0, "Minute"], Quantity[800, "Minute"]}, GaugeLabels -> "Unit"], UpdateInterval -> 1] The tooltip confirms that the gauge is ...


3

Don't know why but if you have a Quantity[513.2441798845927, "Minutes"] wrapped with Dynamic, then AngularGauge can't handle it and shows two inputs, 513.23 and "Minutes" (blue one). I also don't know if that's suppose to happen but here's a work around: Use QuantityMagnitude: Dynamic[AngularGauge[ Dynamic[Refresh[ QuantityMagnitude @ ...


3

Since this has gone unanswered for so long and I can add one clarification to the comments under the question, I'll fill out an answer. In the comments, it has been observed that the following work (with the appropriate definition of customControl): {{x, 0}, customControl[#1, y] &} {{x, 0}, customControl[Dynamic[x]] &} {{x, 0}, Dynamic@...


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 ...


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

I guess OP wants to read out the result of the "set of instructions": Button["Evaluate", Module[{res}, Speak["Please wait your expression is being evaluated"]; res = Integrate[1/(x^3 + 1), x]; Speak["Your Answer is"]; Pause[0.1]; Speak[res]; Pause[0.1]; Speak["period"] ], Method -> "...


3

A modified version of the solution provided by Kuba, that behaves like an ActionMenu with the option setting Method -> "Queued" popupActionMenu[lbl_, actions_] := DynamicModule[{x, trigger}, Row[{PopupMenu[Dynamic[Refresh[x, TrackedSymbols :> {}], (trigger =.; trigger = #) &], First /@ actions, lbl, BaseStyle -> "ActionMenu", ...


3

Since a PopupMenu exhibits a behavior you are after, let's adjust it to act like an ActionMenu: myActionMenu[lbl_, actions_, opts___] := DynamicModule[{x = Unique[x]}, PopupMenu[Dynamic[x, (# /. actions) &], First /@ actions, lbl, opts] ] myActionMenu[ "Print Factorials", {"4!" :> Print[4!], "7!" :> Print[7!], "10!" :> Print[10!]} ]


3

The documentation for model manipulations can be found here. Converting from one model to another is very straightforward. Just do new[old[...]]. For example, TransferFunctionModel[StateSpaceModel[{{{a}}, {{b}}}]]


3

The way I read the documentation one can only control the background color of a Setter or SetterBar. That is to say the foreground color is not available to the user. If you are willing to use buttons, then I think you can accomplish your goal. I used Cyan and Gray rather than Blue and Black for visibility. Manipulate[ Column[{ {opt, colA, colB, colC}, ...


2

Here is one potential alternative to using Trigger. DynamicModule[{n = 1, ss = Infinity, s}, Column[{Manipulator[Dynamic[s, TrackedSymbols :> {}], {1, 10, 1}, Appearance -> "Open"], Row[{Dynamic[Refresh[n++, UpdateInterval -> Max[1/s, ss], TrackedSymbols :> {}], n--, TrackedSymbols :> {ss}, UpdateInterval -> Infinity], Spacer[...


2

You can use the second argument of Dynamic so that the plot changes only after the y popup menu is selected. DynamicModule[{x0 = "a", xvalue = "a", y0 = "a", yvalue = "a"}, {(* x value popup menu *) PopupMenu[Dynamic[x0], vars], (* y value popup menu *) PopupMenu[Dynamic[y0, (xvalue = x0; yvalue = y0 = #) &], vars], (* the plot *) Dynamic[...


2

Specify a control: FormFunction[{"mm" -> <| "Label" -> labelimage, "Interpreter" -> "Boolean", "Control" -> Function[Toggler[#, {True -> checkimage, False -> uncheckimage}, uncheckimage]] |>}][]


2

Expanding on Kuba's answers, if you use Dynamic for both controls I believe you can fully accomplish your goal. When you set filter it will both gray out the elements less than the filter in list and if the element in list is less than the filter it will reset it to the filter value. Manipulate[ {filter, list}, (* Manipulate Controls *) {{filter, 1}, ...


2

Use the function: "EventHandler", just like follows: reportDate = Today; a = Dynamic[ With[{date = Interpreter["Date"][reportDateInput]}, If[DateObjectQ@date, reportDate = date, reportDate]], TrackedSymbols :> {reportDateInput}]; b = InputField[ Dynamic[reportDateInput, {None, With[{date = Interpreter["Date"][#]}, If[...


2

I just want to point out the Edmund's fancy version of Manipulate is unnecessarily complicated. The same effects can be gotten with much simpler code. Manipulate[ Plot[Sin[a + b x], {x, 0, 10}], Row[{ Control[{{a, 0, ""}, {0, 1}}], " ", Dynamic @ Switch[a, 0, "Zero", 1, "One"]}], {{b, 1, ""}, 1, 5, Appearance -> "Labeled"}] ...


2

Here is some code that will let you vary the shape you are rendering fairly easily but does not use Manipulate. It might be useful to you in the short term. I will put more work in this problem, and try to build a useful interactive version with Manipulate. I will update this answer when I have such code. With[{n = 100}, z = Subdivide[0, 2 Pi, n]; x = ....



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