In a Manipulate expression I have a slider control which has the Enabled option

Enabled -> Dynamic[bool]

When bool changes from False to True, the content pane in the output cell of the Manipulate expression should change from

enter image description here


enter image description here

and the slider should go from disabled to enabled. The visual change takes place as expected, but the slider stays disabled.

Can anyone explain this behavior and suggest a way to fix it? Here is my code:

      content = {Black, Circle[], Red, Disk[{0., 0.}, r]},
      RunScheduledTask[bool = True, {2}]];
    Graphics[{content}, ImageSize -> 200],
  {{r, 0.5}, 0., 1., 0.1, Enabled -> Dynamic[bool],
                          Appearance -> "Labeled"},
  {content, ControlType -> None},
  ControlPlacement -> Bottom,
  Initialization :>
    (content = {Blue, Disk[]};
     bool = False)]

I did test a slider that was not inside a Manipulate expression and that had a dynamic Enabled option. It worked fine. So why not in Manipulate?


I contacted Wolfram Research support and got back a suggestion for a work-around. It wasn't what I was hoping for, but it did lead to me something better than I had before. Only problem remaining is that the Mathematica editor's syntax checker doesn't like what I did. I'm living with that. Here are the details:

enter image description here

The question now boils down to: Can the syntax checker be propitiated?

Another Update

I received another response form WRI tech support.

After talking to our developers, it seems that your original method of using ControlType -> None should have worked after all. This now looks to be an issue of bad interaction between RunScheduledTask and DynamicModule. This issue has been filed into our database so that our development team can fix it at the earliest.

  • 1
    $\begingroup$ It works fine on my machine, what version of Mathematica are you running? (I'm on MMA, Windows 7 64bit) $\endgroup$ Commented Oct 26, 2012 at 1:26
  • $\begingroup$ Your code works as expected on my system (MMA V, Windows Vista 64bit) $\endgroup$
    – kglr
    Commented Oct 26, 2012 at 1:26
  • $\begingroup$ I'm running 8.0.4 on OS X 10.6.8. I guess I should contact WRI support about a possible OS X issue. Thanks for checking this out on your systems. $\endgroup$
    – m_goldberg
    Commented Oct 26, 2012 at 2:27
  • 4
    $\begingroup$ Every part of this question touches on something which horrifies me. DynamicModule variables were never designed to escape the confines of the DynamicModule which scopes them, but scheduled tasks do quite a nice job of punching a hole in those confines. We should figure out how to deal with that problem, but haven't yet. Module, on the other hand, creates an unexpected global (not local) variable which is scoped to the current kernel session. For this reason, mixing Module and Dynamic or Manipulate is always a bad idea. That's why you get the syntax highlighting. $\endgroup$
    – John Fultz
    Commented Nov 11, 2012 at 22:54
  • 3
    $\begingroup$ [continued] So there are a number of ways to do this which might appear to work at first but which are open to subtle failures. Really, the only way to get this to work is to have the scheduled task and dynamic code communicate using a global variable. You'll have to initialize this variable properly. You can hide it in a private namespace. If you hope to have multiple manipulators functioning independently, it gets more challenging. I have some thoughts about per-instance creation of unique variable names, but it would take some effort to work this up. $\endgroup$
    – John Fultz
    Commented Nov 11, 2012 at 22:59

1 Answer 1


I read an answer to another question that made use of Clock and the proverbial light bulb lit up in my head -- so now I can answer my own question, at least in the part that asks "suggest a way to fix it".

    If[Clock[{False, True}, 3, 1],
       content = {Black, Circle[], Red, Disk[{0., 0.}, r]}; bool = True];
    Graphics[{content}, ImageSize -> 200],
    {{r, 0.5}, 0., 1., 0.1, Appearance -> "Labeled", Enabled -> bool},
    {{bool, False}, ControlType -> None},
    {{content, {Blue, Disk[]}}, ControlType -> None},
    ControlPlacement -> Bottom]

I hope this answer doesn't horrify John Fultz as much as the question did.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.