5
$\begingroup$

IntervalSlider seems to ignore Dynamic's second argument:

x = {0, 1};

Slider @ Dynamic @ x[[1]]         (*works well*)
Slider @ Dynamic[x[[1]], None]    (*works well, locked*)
IntervalSlider @ Dynamic[x, None] (*wrong, should be locked but isn't*)

Dynamic @ x

IntervalSlider should be locked the same way the second Slider is. That is not the case.

Is it a bug, is there a workaround?

$\endgroup$
5
$\begingroup$

I'd say it was a bug. Here's a workaround:

IntervalSlider@Dynamic[x, # &]

The sliders move when dragged but pop back to the original setting when released. I don't like that, but maybe it's supposed to do that.

Update

The bug seems to be in NotebookTools`ControlsDump`extractFunction: The case where a single None is passed for the update function(s) is not handled, and the call defaults to the equivalent of

Dynamic[x, {None, Automatic, None}]

Another possible workaround is the following, which is what a simple None should have been mapped to:

Dynamic[x, {None, None, None}]

Yet another fix is to extend the internal function to handle None, but that's not a safe fix, IMO:

NotebookTools`ControlsDump`extractFunction[which_, None] := Null &;
$\endgroup$
  • $\begingroup$ Yes, I agree, already reported. Wanted to post it here for future reference. Also the problem seems to be deeper, in case of foo in place of None it will be ignored unless we transform it too foo[#]& which indicates sloppy implementation. $\endgroup$ – Kuba Feb 3 at 15:31
  • 1
    $\begingroup$ I faced this because my code was not working: IntervalSlider[Dynamic[x, {foo, bar}]]. Based on extractFunction it is clear that foo[#]& is needed but I don't think that is expected. $\endgroup$ – Kuba Feb 3 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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