Questions relating to the dynamic family of functions in Mathematica, such as Dynamic, DynamicModule and Manipulate.

learn more… | top users | synonyms

6
votes
1answer
265 views

LocatorPane and multiple EventHandlers, PassEventsDown option

Consider the following piece of code from Heike as an ( accepted ) answer on LocatorPane, selecting multiple Locators - Basically the code implements dragging polygons on a LocatorPane. ...
6
votes
1answer
871 views

How to make a dynamic stopwatch?

For some experiments I need some basic timer function. I tried various methods, and neither of them are fully satisfactory. What I need is a button, that starts/stops a timer, resets timer with each ...
6
votes
1answer
159 views

How can I make sure all InputFields have values before processing a nb form?

This is a two part problem: I have a form that accepts both numeric and text inputs, then runs a function using a "process" Button. The issue I'm having is users that forget to fill out all of the ...
5
votes
3answers
167 views

Creating a Tooltip that knows what platform is currently being used

I have Mathematica 8 on my PC. I also have a new Mac with CDF-player, but not Mathematica. I want a Tooltip that shows one thing if running on a PC, and something ...
5
votes
3answers
384 views

How do you properly create Buttons to change dynamic variables using Table

In this example, I want a series of four buttons to change the value of a variable that is used dynamically to drive a plot. I am trying to figure out why using Table around the buttons causes a ...
5
votes
2answers
925 views

Equivalent of MATLAB's “hold on” function

I'm making an animation where the number of iterations is known. I tried using Dynamic, as I prefer updating in real time over generating data before plotting. I ...
5
votes
2answers
192 views

How to make DynamicModule work without an extra ENTER

I've been trying to learn more about DynamicModule (I do not use them, as I used Manipulate all the time). After some time ...
5
votes
3answers
324 views

Unexpected Setter Bar Behavior when Manipulate Nested in Dynamic Module

Consider this code: DynamicModule[{x, y}, x[t_] := t^2 + 5; y[t_] := t^3 + 5; Manipulate[Plot[fcn[t], {t, -5, 5}], {fcn, {x -> "Square", y -> "Cubic"}}]] ...
5
votes
1answer
284 views

“Masking” an InputField

In building an assignment for my class, I would like set up an InputField, where they will enter a function. I was wondering if there was a way to "continuously" check if their function is being ...
5
votes
2answers
120 views

Checkbox behaving weird when variables are local

I have a DynamicModule in which I need a checkbox with a Max in the dynamic part: ...
5
votes
3answers
304 views

Question about modifying a Slider2D control

Background: I want to develop a custom control, based on a 2D slider. I currently have this ( working ) example. ...
5
votes
1answer
185 views

How to add several Locators to a Graphic with a mouse click?

Background: Suppose I have something like this: ...
5
votes
2answers
292 views

How to dynamically update Locator[] constraints?

I need to visualize Menelaus' theorem for a triangle with moving locators for each of six points. So the vertexes of the triangle can move in any possible way, and the three points on the sides of the ...
5
votes
1answer
283 views

How to get state of checkbox?

Please explain how to get state of checkbox for its usage in further calculations. And I want to keep the selection from session to session without external savings. Thanks in advance
5
votes
1answer
300 views

Basic question about Dynamic

Please consider the following: ...
5
votes
1answer
191 views

Using free-form linguistic input in a dynamic input field

I've been playing around with dynamic input fields; here's a basic example, which just consists of an input field where the user can enter a function and then a button that can be clicked to graph the ...
5
votes
3answers
366 views

Interpolation with boundary conditions

I'm working on a sales projection, trying to create some flexibility in handle the forecast using locators. The toy code is something like this: ...
5
votes
5answers
875 views

sliding a tangent line along a curve

I am confused by Dynamic. I am trying to slide a tangent line along a curve, without using DynamicModule, so that I can include ...
5
votes
2answers
290 views

How to create a ListLinePlot with a layout analogous to ChartLayout -> “Stacked”?

I am using 3 checkboxes as desktops, portables and ipods in such a way that when I click to desktops it should shows ListLinePlot of ...
5
votes
3answers
434 views

Printing a Dynamic variable inside Dynamic

I'm trying to Print the variable a inside the Dynamic wrapper. Seems like such a simple question, but I haven't been able to get ...
5
votes
1answer
201 views

Control variable and body variable decoupling in Manipulate

This issue was raised as an offside problem in this thread. Consider the following example, that does not work as expected: ...
5
votes
2answers
72 views

Using gamepad without dynamic

I am a novice using Mathematica. I program regularly using c like languages though. Now i work on a simulation of a vehicle. I have a loop that calculates the next state of the physical model every dt ...
5
votes
1answer
139 views

How to inherit options by scoping?

Consider the following example: you have a function framed producing a cell with a button that, when pushed, calls framed again. ...
5
votes
1answer
187 views

How to make a piece of a pie chart change color upon clicking it?

I am trying to use the EventHandler and have managed to make the text change color upon clicking it, but cannot seem to make each piece of the pie chart change ...
5
votes
1answer
190 views

Using the keyboard to interactively and dynamically specify coordinates in a grid (a la Battleship board game)

In Mathematica, it is possible to create a Table or Grid of \[Placeholder] boxes. For ...
5
votes
1answer
183 views

Why does Dynamic output cause CPU usage when onscreen?

I write such a line in Mathematica: {Slider[Dynamic[s]], Dynamic[f[x_] := s*x]} After evaluation, the CPU immediately runs at full power. And if you scroll the ...
5
votes
1answer
368 views

Progress indicator with shared variables

I'm trying to create a custom progress indicator for a parallelized computation, using Dynamic and SetSharedVariables to display ...
5
votes
1answer
123 views

Is there a way to make an interactive plot so one can pan and zoom?

My googling efforts returned nothing so I thought I'd ask here. I often make a ListPlot[] with a huge array, and sometimes it has smaller features that I'd like to take a closer look at, but aren't ...
5
votes
2answers
101 views

How to robustly apply ToBoxes to a Dynamic expression?

Inserting a Dynamic object in a boxform expression messes up syntax colouring. See the following example. where the variable ...
5
votes
1answer
172 views

How can I use Dynamic to run a script when a new file is added to a directory?

I have an external program saving files to some directory on my hard disc. I'd like to run a script that imports and runs a script on each file as it is added to the directory. Is there a simple way ...
5
votes
2answers
391 views

Interactively select a row/column of a Grid

I need a simple way to display tabular data (preferably with Grid) and also be able to select a row or column of the table. I've tried different approaches, but I ...
5
votes
1answer
421 views

Enabled option for slider in Manipulate not updating dynamically

In a Manipulate expression I have a slider control which has the Enabled option ...
5
votes
1answer
232 views

How to convert String to an Expression inside Manipulate which depends on control variable

Normally, in Global context, these 2 are equivalent eqn = "r-x"; r = -2; Plot[ToExpression[eqn], {x, -5, 5}] and ...
5
votes
1answer
344 views

Make EventHandler work for clicks and keys in a Dynamic display

I am trying to write a way that will do certain events depending on what screen is showing. What happens so far is that the screen will change in accordance to a click, but when you try to do the ...
5
votes
1answer
226 views

What changes in Dynamic have occurred from Mathematica 7 to Mathematica 8 that might induce incompatibilities?

I have a function that outputs a Manipulate (say FAnimated[params_]:= Manipulate[F[params,t], {Time, Animator[t]}] where F ...
5
votes
1answer
151 views

DynamicModule variables that retain values during code reloading

At times I'll find myself building a some interface component where I want to have some localized dynamic variables, and while testing I might realize that some bit of the code needs to change, which ...
5
votes
1answer
289 views

Function that evaluates in notebook does not evaluate in CDF

I am trying to access the values of a dynamic value outside function package. Within the function package, the function is defined under the Dynamic module option. There is an error with this. I ...
5
votes
1answer
86 views

Notebook's WindowSize interference with contents' Dynamic ImageSizes

Consider the following MWE: ...
5
votes
1answer
102 views

FlipView can't handle CurrentValue[“MouseOver”]. Kernel crash

Is this code crashing your Mathematica session? (it can so look out :P) ...
5
votes
1answer
147 views

How to make MousePosition more reliable

This takes a little patience to reproduce, but I got a screenshot of it in version 9 on Mac OS X 10.7.5: With a small Graphics object, it occasionally happens that ...
5
votes
1answer
81 views

How to track Part of Symbol or How to symbolize Parts of Symbol without copying data

Let's create simple function: SetAttributes[h, HoldFirst]; h[data_] := Dynamic[Grid[data], TrackedSymbols :> {data}] test = RandomReal[1, {2, 2}]; h[test] ...
5
votes
0answers
61 views

Graph: PropertyValue changes and Dynamic

I almost never work with Graph in Mathematica but lately I helped someone with it. For this, I tried to make an animation using ...
4
votes
4answers
221 views

How to avoid writing $K$ loops?

I want to evaluate a mathematical function of $K$ variables each of variables varying between 1:N. One way to do this is writing $K$ loops and varying variables accordingly, as shown below: ...
4
votes
3answers
135 views

Using Mouseover to change the appearance of a button without writing the button specification twice

When I code in Mathematica, I often find myself having to repeat large chunks of code for a function to work. The latest example of this is a color changing button that prints when clicked, code shown ...
4
votes
2answers
284 views

How can I change a Slider's appearance?

I am using Mathematica 9.0 and Windows 7. I want to create a Slider that looks like the following: I tried the following: ...
4
votes
2answers
169 views

How to execute a function each time the slider is dragged?

I've created a function f and a slider: Slider[Dynamic[y],{1,4}] How to execute/call f ...
4
votes
2answers
397 views

How can one popup menu be used to add another?

I'm trying to construct a GUI that changes depending on what's chosen in certain popup menu's. For example: The default state of the menu is condition one, but when the first PopupMenu is selected ...
4
votes
3answers
318 views

How can I compare a dynamic variable with a literal in Mathematica?

I'm doing a Mathematica Notebook and I want to make an alarm clock. Something like this: ...
4
votes
3answers
139 views

Dynamic ListLinePlot

I have a list of lists looking like this: {{{x1, y1}, {x2, y2}}, {x1, y1},...}}. Furthermore I have defined a legend, which is taken from the filenames. Now I want ...
4
votes
2answers
624 views

Moving From Dynamic Module to Manipulate

In trying to implement Vitaly's suggestion about how to take control of Locator events, I have been able to make headway using ...