# Tag Info

1

Pass a symbol to Preplot, treat Preplot as a controller. I think this is a more idiomatic approach. ClearAll@Preplot; SetAttributes[Preplot, HoldFirst]; Preplot[data_, lims_, initialData_, limsL_, limsR_, limsteps_] := DynamicModule[{n = Length[initialData]}, data = initialData; Grid[Table[With[{i = i}, { lims[[i]], Slider[ ...

11

J. Fultz' answer indicates that it is not a bug but a feature which needs better documentation. Get a habit of defining your procedures with [], e.g. f[]:=Print[1]. (Which creates DownValues instead of OwnValues). DynamicModule saves its variables OwnValues in the first argument of DynamicModule. It which does not support SetDelayed and is sliently ...

4

FrontEndTokenExecute[nb, "EvaluateNotebook"] does not return anything, it won't wait for a nb to finish evaluating. If it worked I think it was a coincidence. Compare those examples: The first one is analogous to your approach. procedure1[] := Module[{nb}, nb = NotebookPut @ Notebook[ Table[ Cell[BoxData@MakeBoxes[Print[#]; Pause[1];], "Input"...

2

A self-closing dialog window using NotebookDynamicExpression selfclose1[content_, closetime_] := CreateDialog[ Column[{ content, CancelButton[ImageSize -> Full]}], NotebookDynamicExpression -> Dynamic[Refresh[ If[Clock[closetime, closetime, 1] == closetime, NotebookClose[]], UpdateInterval -> closetime, TrackedSymbols :&...

2

This is what I understood OP needs: SetAttributes[foo, HoldFirst]; foo[proc_] := Module[{dialog}, dialog = MessageDialog["whatever"]; RunScheduledTask[NotebookClose @ dialog, {3}]; proc] a more advanced example can be found in Palette button with progress bar

4

Here's a quick mockup of what it sounds to me like you are attempting: DynamicModule[{iTabCount, iSelectedTab, tabSlider, tabUI}, iTabCount = 5; tabSlider[_] = 0; tabUI[i_] := Column[{ Slider[Dynamic @ tabSlider[i], {-1, 1}], Dynamic @ Plot[Sin[x + tabSlider[i]], {x, -2 Pi, 2 Pi}] }]; Column[{ Dynamic @ TabView[Array[...

2

Oh, sorry everyone. I've got an answer here right after I posted my answer...... But I think this solution may be helpful for other users annoyed with Pause: new = CreateDialog[Plot[x^2, {x, 0, 1}]]; PrintTemporary@DynamicModule[{t = Now, check = True}, Dynamic[ If[check && Now - t >= Quantity[3, "Seconds"], NotebookClose[new]; ...

10

Edit Can you think of another way to accomplish the same thing [...]? It would be nice to have a solution that didn't involve duplicating each slider. -nibudd DynamicModule[{a = 1, tempA = 1, auto = True} , ifAuto = Dynamic[ If[auto, Identity, Setting]@#, TrackedSymbols :> {auto} ] &; Column[{ ifAuto @ Dynamic @ Plot[Sin[...

3

Things to keep in mind when developing complex GUI in Mathematica: Styles management/inheritance system (StyleSheets and friend) It is complicated, full of exceptions and only a tip of the iceberg is documented. Those 3 features are limiting the usage of it, which is a pity because it has a potential to give a lot. I'm also missing guidelines about common/...

7

Here is a modification of Karsten's answer attempting to get the behavior you described in a comment. The selected value is assigned to Global\$color (as shown by Dynamic) I made the picker wider to get rid of the annoying bottom scroll bar Code: Button["Pick a color", Module[{picker, box = EvaluationBox[]}, picker = FrontEndResource["...

10

Do you mean Button[ Tooltip["click", Column[{"Click this button to select a ColorScheme.", "This button will be replaced with ColorData"}]], With[{box = EvaluationBox[]}, SelectionMove[box, All, Expression]; FrontEndExecute@ FrontEndAttachCell[box, FrontEndResource["ColorSchemeSelector"], {1, {Right, Top}}, {Left, Top}, "...

18

In this case I don't know how to post something helpful without providing full code so I'll just do that and hope this wasn't homework. My emphasis is on clarity (hopefully) rather than brevity or peak efficiency. flip = # /. {LightRed -> LightBlue, LightBlue -> LightRed} &; flipNeighbors[i_, j_] := (color[##] = flip @ color[##];) & @@@ ...

2

A modification of your last code block BulletTOTAL = Table[BulletGauge[{DataFile[[i, 5]], DataFile[[i, 4]]*0.75}, {DataFile[[i, 3]]}, {0, DataFile[[i, 4]], DataFile[[i, 6]], DataFile[[i, 7]], MaximoEscala}, ImageSize -> Large, GaugeLabels -> Placed[Style[ Rotate[DataFile[[i, 2]] <> "\n" <> DataFile[[i, ...

6

I think you should change your setup a little bit. Including procedures inside Dynamics is useful somethimes, for better events handling, but nothing fancy is going on here. Thus it is better schedule calculations in a more stable way, by moving the Grid generation outside Dynamic. Your exporting procedure clearly expects myplots to have an up to date ...

2

Regarding the lack of control of the output size, at least with a sufficiently high ImageResolution setting it can be tuned: test = Framed["TEST", Background -> Red, FrameStyle -> Blue, ImageSize -> {100, 100}, ContentPadding -> False] ImageDimensions[Rasterize[test, ImageResolution -> 354]]

7

What is going on By default the Dynamic, EventHandlers and various controllers like Button and Slider use a PreemptiveLink to communicate with the kernel. Synchronous versus Asynchronous Dynamic Evaluations about the PreemptiveLink: [...] There is no queue; instead, the front end sends one evaluation at a time and waits for the result before ...

Top 50 recent answers are included